---
title: "The effects of party labels on vote choice with realistic candidate differentiation"
author:
- affiliation: London School of Economics and Political Science & Sciences Po
  name: Noam Titelman
- affiliation: University College London
  name: Benjamin E Lauderdale
date: "`r format(Sys.time(), '%B %d, %Y')`"
output:
  bookdown::pdf_document2:
    fig_caption: yes
    keep_tex: yes
    template: header.tex
    toc: no
    citation_package: natbib
    latex_engine: xelatex
  html_document:
    df_print: paged
  pdf_document:
    toc: no
  word_document: default
bibliography: master.bib
geometry: margin=1in
keywords: 'Party Identity, Policy Vote, Party labels'
classoption: a4paper
biblio-style: apsr
spacing: double
thanks: '**Corresponding author**: noam.titelman@sciencespo.fr'
abstract: "In this paper we test how much party labels influence vote choices between candidates when voters have access to realistically distributed information about candidate positions and demographics. We do not seek to adjudicate a long-running debate about the role of party labels, but present some nuances on the two archetypal theoretical views on vote choices.  We use data from the Representative Audit of Britain (RAB) and the British Elections Study (BES) to generate electoral match-ups between randomly selected Conservative versus Labour candidates, with only half of respondents seeing party labels in addition to candidates' positions and demographics. For our experiment fielded in October 2021, we find negligible to moderate effects of party labels on vote choices. Our results suggest the information on candidate positions and party labels largely act as substitutes for one another, with only modest changes when party labels are made explicit."
---


```{r,include=FALSE}
library(knitr)
library(kableExtra)
knitr::opts_chunk$set(eval = TRUE, echo = FALSE, message=FALSE, warning=FALSE)
knitr::opts_chunk$set(
  tab.cap.style = "Table Caption",
  tab.cap.pre = "Table ",
  tab.cap.sep = ": "
  )

library(haven)
library(tidyverse)
library(naniar)
library(sjPlot)
library(ggthemes)
library(gridExtra)
library(scales)
Data_Exp1<-read.csv("Data_Exp08.csv")
Data_Exp1AB<-read.csv("Data_Exp0_AB8.csv")

```

A party label might be relevant to voters because it works as a heuristic that provides a proxy for a candidate's policy positions [e.g. @fiorina2002parties], or because citizens have an affective attachment to a party that is not simply a function of the party's positions [e.g. @campbell1960american].  Similarly, a candidate's policy positions might be relevant to voters because they care about those positions as such, or because they act as heuristics for whether the candidate ought to be the subject of the voter's group-based attachment to a party.  One of the major divides in interpreting the evidence on the role of partisanship on voting has been between viewing party preference as a summary evaluation of the party's bundle of policy positions and/or past performance versus as an independent driving force of vote choice on its own.  @fowler2020partisan articulates this debate in terms of a vote motivated by policy versus by "partisan intoxication": voters supporting candidates according to policy preferences and beliefs about government performance versus voters "blindly support that party in elections, regardless of the candidates' policy positions" (p.142).  While these are fundamentally different views about what voters actually care about, they have proven to be surprisingly difficult to disentangle empirically. While this paper does not attempt to adjudicate this long-running debate, it seeks to further our understanding of the way these elements may interact.

One reason that these perspectives are difficult to distinguish between is that they need not be exhaustive or mutually exclusive. For example, it is easy to imagine that individual voters have some policy concerns, but can also get caught up in a desire for their "team" to win in a way that means they are not precisely tracking their policy and performance interests in election outcomes, even as they themselves understand them.  Another reason that these perspectives are difficult to distinguish is that there may be variation across different groups of voters in the degree to which each theoretical perspective captures individual behaviour.  But perhaps the most important reason that these perspectives are difficult to disentangle is that they make largely similar predications about voter choice in typical political circumstances, despite their apparently different implications for democratic accountability and underlying accounts of what citizens actually care about when making political choices.

Normal political conflict does not put these perspectives in conflict with one another, and where it does, it does so in ways that make distinguishing between the perspectives difficult.  Most candidates take positions aligned with their party.  Where they do not, their deviations are potentially endogenous to variation in the preferences of the voters they face and their competitors.  Studies that rely on observational data cannot rule out candidate and candidate position selection mechanisms that might provide alternative explanations for the relationship between candidate policy positions, party affiliations, and citizens' attitudes on policy and party (examples of such studies are @campbell1960american; @vivyan2012voters; @ansolabehere2010constituents; @canes2002out).

Recent work has attempted to address these limitations by using conjoint experiments to independently vary the presence and/or identity of party labels along with various policy positions and other attributes of candidates [e.g. @kirkland2018candidate; @mummolo2019limits; @fowler2020partisan]. However, these experiments heavily trade off external validity for gains in internal validity, using fully independent randomization of candidates' attributes that generate unrealistic frequencies and combinations of candidates' attributes and party affiliation. In the real world, candidates within a party have varying positions, whether due to natural variation in positions among co-partisans or due to strategic public positioning given varying electoral contexts, but typically this variation is constrained by the range of acceptable positions within their party [e.g. @snyder2003roll].  While it is interesting to test the limits of partisan vote when candidates deviate completely from party platforms, this risks a situation where respondents are not responsive to the party label, not because they care more about policy, but because they stop taking the party label seriously as they know that no one from that party would actually hold the presented positions. Furthermore, in candidate experiment testing the limits of partisan loyalty, @mummolo2019limits show how respondents' preferences can be markedly different for hypothetical Republican and Democrat candidates when these hold realistic policy positions to when the experiment includes candidates with positions that deviate from those expectations.

Even with this kind of setup, manipulating policy and identity positions in an experimental setting is highly challenging.  As @orr2023affective argue, respondents might use given information on policy or identity to infer the other. Information on the partisan affiliation of fellow citizens might influence beliefs about policy positions, and information about policy positions might influence beliefs about candidate party affiliation. Similarly, @titelman2021can show that when provided with realistic information on fellow citizens' demographics respondents can, on average, infer the party affiliation of these citizens. @carlson2022experimental arrive to a similar conclusions when including information of both demographics and policy positions. The fact that no list of presented policy positions or demographic characteristics is going to be exhaustive of the issues that respondents care about presents a further complication.  Even if respondents care only about policy or demographic characteristics, they might appear to care about party labels because these stand in for all the other issues that are not being presented as part of an experiment, yielding a policy-based explanation for response variation driven by party label.


In light of these many challenges, this paper does not attempt to adjudicate the long-running debate about the correct causal model of voting, and instead attempts to describe the relative importance of party labels and policy preferences in a context where these policy positions are benchmarked to the real joint distribution of these positions in the candidates of the two main parties. This study provides a valuable combination of substantially more credible causal inferences than observational designs plus better external validity [@delacuesta2019improving] than other similar experimental designs. All laboratory experiments, such as this one, suffer from risks to their external validity due to their artificial nature. Nonetheless, previous research has in fact shown [@delacuesta2019improving; @hainmueller2015validating] that better, more realistic designs of these experiments can improve their external validity.

However, it does not seek to provide a measure of the relative importance of identified causal inferences regarding party versus policy trade-offs [e.g. @orr2023affective].
We design a novel experimental strategy which A) randomizes the presence versus absence of party labels and B) randomizes the profiles of positions and characteristics of candidates for each party. The candidate positions and characteristics are not independent of one another, or of the party of the candidate, but rather are benchmarked to the real distributions of positions and characteristics of candidates of the party at the 2017 British general election.  The presence versus absence of party labels is, however, independent of the candidate positions and characteristics, so we can observe the relative association of each candidate and characteristic with vote choice with versus without an explicit party label.  Using data on past vote choice, we compare how consistent respondents are in terms of their previous vote and the choice they make in the experiment. Using data on past positions expressed by our respondents and their demographic characteristics, we can also assess how much the proximity of candidates to the respondents' own positions and characteristics predict their vote choices, with and without party labels.

In our experiment fielded in the UK in October 2021, we find that "correct voting", in either the @lau1997voting sense of matching one's own political positions or in the sense of matching past individual vote, is reasonably high in the condition where respondents do not observe party labels. The presence of party labels does further increase the match between past vote and vote in the experiment.  The partial associations of candidates' positions matching a respondent's positions for vote choice declines in the presence of party labels, but do not entirely disappear.  At the moment our experiment was completed we find an asymmetric relationship between policy and partisanship. Labour voters in the 2019 general election are found to consistently choose Labour candidates in our experiments both with and without party labels. Conservative voters in the 2019 general election, on the other hand, are found to be less consistent in their vote for Conservative candidates in our experiment, especially in the absence of party labels.  We discuss possible interpretations of this asymmetry, relating to the political moment of the survey as well as policy sorting.  We conclude the paper by noting that the results of this experiment do not "answer" the long-running debate about the role of party labels and partisanship in vote choice, however they do put some constraints on how the two archetypal theoretical views can each explain observed patterns of vote choices.


## Vote choice, policy preferences, and partisanship 

Voters may prefer candidates from certain parties because they feel an affective or identity attachment to the parties [@campbell1960american; @green2004partisan] or because parties work as cues, aiding in complex decisions on policy platform preferences and past performance [@fiorina1981retrospective; @fiorina2002parties]. @fowler2020partisan articulates this debate in terms of a "partisan intoxication" vote versus a vote motivated by policy. Party intoxication would be an explanation for vote choice where voters "blindly support that party in elections, regardless of the candidates' policy positions" (p.142). In other words, in its strongest form, the affective or identity attachment perspective on voting implies candidate choice might take place even without policy considerations. As @mason2018uncivil affirms, this view would imply that "citizens do not choose which party to support based on policy opinion" (p.20). Of course these two explanations for vote choice need not be exhaustive or mutually exclusive [@fowler2020partisan;@rogers2020sobering].

Regardless of which perspective one takes, citizens' propensity to vote in a partisan manner is not limitless and generally loyal voters might defect because the candidates they have to choose from in particular elections take on different issue or positions [@boudreau2014informing;@mummolo2019limits] or for other reasons. For example, there is evidence in the US that vote choice is somewhat responsive to legislators' voting records, at least under some circumstances [@ansolabehere2010constituents; @canes2002out; @nyhan2012one].  Less has been written on any specific country outside of the US.  The studies available for the UK find that candidates' issue and policy positions matter very little relative to party for vote choice [e.g. @butler1971political; @vivyan2012voters; @hanretty2021members].

Even with policy voting, party labels can still be very influential for vote choice as they implicitly provide a summary of the policy positions of candidates [@fiorina1981retrospective]. This is a key reason that the affective/identity model and the heuristic/policy summary models of partisanship are difficult to disentangle empirically. The same electoral behaviour, i.e. voting consistently for a party, can result either from blindly following a party regardless of what it does or proposes to do, or from rationally supporting the party that consistently provides the best match to your preferred bundle of policies weighted according to your personal priorities. As @fowler2020partisan explains "[d]istinguishing between partisan intoxication and policy voting is difficult because the positions of voters and parties on important issue change infrequently" (p.156).

If we want to measure the relevance of candidates' attributes in the presence of party labels, another difficulty is that observational data is subject to selection bias regarding the characteristics of the candidates who choose to run in different constituencies. For example, @snyder2003roll describe how party positioning and individual candidates' positions may interact. Candidates may only move across a limited interval of positions that are consistent with being a member of their party. The chosen position depends on the preferences of the districts' populations and their own, and so their (expected) electoral performance in real elections may be a cause of, as well as an effect of, the positions they take on relative to those of their co-partisans.

Some observational studies focus on formally non-partisan matches to determine the relative importance of party affiliation and candidates' characteristics. These studies find that  contests where candidates are forced not to reveal a partisan affiliation do show a smaller degree of partisan alignment with the vote choice among the electorate, even where the partisanship of candidates can be identified by researchers [e.g. @lim2015more; @schaffner2001tearns] and a greater importance of the candidates' attributes [e.g. @badas2019voting]. However, in elections where party labels are omitted because of regulations another difficulty arises: voters might infer the party affiliation of candidates even in the absence of explicit party labels. For example, @lucas2020non shows that municipal governments are responsive to the ideological preferences of their constituencies in Canada, even though elections are formally non-partisan. The fact that voters might act in ways that appear to be policy-based in non-partisan elections could potentially arise even if voters were purely party motivated, as they use policy positions as cues to infer the true partisan alignment of the candidates rather than because they care about the policy as such.

Some, but not all, of these issues can be addressed using experimental designs, where candidate positions and party affiliations can be randomized. Recent experiments have enabled researchers to test a number of hypotheses which follow from the different theoretical models of the relationship between party and voting. For example, @fowler2020partisan reanalyses data from @hainmueller2014causal conjoint experiment for candidates in the US. He theorizes that in the presence of policy voting, including more information on candidates would reduce the effect of party labels. He finds that "the presence of additional, randomly assigned information about candidates is enough to induce most respondents to deviate from their party some of the time" (p.166).

At the same time, experiments have shown that, in the presence of party labels, candidate characteristics such as gender or ethnicity, become less relevant [@burnett2015party; @kirkland2018candidate; @lavine2012ambivalent; @rahn1993role]. Conversely, in the absence of party labels, candidates' attributes may become more relevant. For example, @kirkland2018candidate find that when choosing a candidate in competitions with no party labels, Republican voters give more importance to job experience, while Democrat voters assign more importance to political experience. However, these studies are not exempt from the risk that respondents infer partisan affiliations, even in the absence of such labels. For example, @kirkland2018candidate present experimental evidence that voters exhibit preference for local candidates that signal partisan or ideological affiliation without using labels. As @fowler2020partisan points out "[b]ecause respondents will make inferences about many thing in response to a given piece of information, survey experiments may never allow us to definitively demonstrate or rule out partisan intoxication" (p.164). Even so, while adjudicating which theoretical model of political behaviour is a closer match to reality is difficult, such experiments give us new evidence about how voters respond to variations in their political choices that is useful for making progress on our understanding of voters' behaviour.


## Candidate choice in the UK

The relevance of candidates' positions has been studied less for the UK than for the US. In part, this is the result of a strong tradition of viewing the vote as divided between class lines, with working-class citizens voting for Labour and middle-class citizens for the Conservatives [e.g. @butler1969stokes; @butler1974political]. Even vote choice theories less reliant on social and party identity have tended to give little attention to the individual positions of candidates, emphasizing the roles of party manifestos and leaders [@clarke2004political]. Strong party discipline in the House of Commons means that individual MP deviations from the party line are rarely visible, and even when they are visible, voters seem to pay little attention. For example, @vivyan2012voters find that only voters with negative views of party leadership reward MPs for rebelling and that this gain is small. Similarly, @hanretty2021members find that even on Brexit, the highest profile cross-cutting issue in British politics in a generation, MPs in the UK were negligibly accountable (in terms of electoral support) for their issue positions and that they were aware of this, implying little incentive to take into account the constituencies' positions on issues more generally. The @hanretty2021members paper is really the best case for a clean observational case and there is still not much evidence of issue voting.

Despite this history, we could imagine that candidates' positions might become relevant in the current political environment in the UK. There has been a process of class and partisan dealignment [@sarlvik1983decade], which, as @surridge2020values has pointed out, "gave more 'space' for short-term influences on vote choice" (p.5). Following the "funnel of causality" for vote choice, as defined by @campbell1960american, these short-term influences include issue opinions and candidate image. In the original model of the "funnel of causality", party attachment mediates between value orientations and both issue opinions and candidate image. Without this attachment, other elements may become more relevant. The last decade has seen an unprecedented level of weakening of party attachment in Britain, reflected in the fact that only half of the electorate voted for the same party in all three elections in 2010, 2015, and 2017 [@fieldhouse2021electoral]. At the same time, party discipline in the House of Commons has weakened for relevant legislation [@kam2009party; @cowley2012coalition; @kirkland2018roll], such as the Brexit Withdrawal Agreement [@aidt2021meaningful], potentially raising the stakes of which kind of candidate is elected, beyond just their party affiliation.

The EU referendum and the Brexit debate have brought an important level of realignment with "Leaver" and "Remainer" identities playing a role that may be as important as traditional party identities [@hobolt2020divided]. This might reinforce the relevance of candidates' positions on Brexit, and push voters in directions different from a simple party vote. In the 2019 general election Brexit was a defining issue for many voters and this was partly the result of shifts in voter behaviour which come from longer-term trends, that reflect "the growing importance of value divides in the electorate" [@ford2021british, p.541]. Specifically, voters with more socially conservative views have swung behind the Conservatives [e.g. @surridge2020values].

Values have often been described as dividing the political spectrum in two axes. The left-right axis, linked to traditional economic positions, and the social values axis, linked to positions on authoritarianism and liberalism [@lipset1959democracy]. While the party divide and its class counterpart are typically summarized in the left-right spectrum, the Brexit vote is mainly explained by the authoritarian-liberal axis [e.g. @crewe2020authoritarian; @norris2019cultural; @zmigrod2018cognitive]. How relevant are signals given by the candidates on these value scales? Do they matter less when party affiliation is known?

## Data and Methods

To test the way party signalling affects vote choice, in the context of candidates with realistic attributes and positions, we first create a data set of candidate profiles. For this we combine information from the Representative Audit of Britain (RAB) [@campbell2017representative], and the British Elections Study (BES) to create a data set of nationally representative profiles for both Labour and Conservative candidates in the 2017 general elections. The BES includes complete information on candidates' gender by party and constituency, as well as whether the candidate was elected (632 Labour and 632 Conservative candidates). The RAB includes information from a subset of candidates (385 Labour and 148 Conservative candidates) on their positions for several policy related questions, as well as information on their past participation in local councils, the EU referendum vote, left right positions, and many other characteristics. This information was combined and missing values were imputed using multivariate imputation by chained equations (MICE). This was done using random forest imputation for continuous data and predictive mean matching for all other kinds of data. The imputation was carried out for Labour and Conservative candidates separately to ensure that the distribution of characteristics within each party conserves the party-specific correlations between the different variables. For the imputations, whether a candidate was successful or not was also included as a variable.  This procedure yields a model for generating synthetic candidate profiles from the "population distribution" of hypothetical candidates, with joint distributions of personal characteristics and responses to the RAB questions that matched the known features of the distributions of Labour and Conservative candidates.

We present respondents with two randomly selected candidates from these simulated candidate population distributions characterized by their gender, age, left-right positioning, EU referendum vote, experience in local council, whether the candidate was born in the constituency, and positions over four broad policy issues.  We then ask respondents to choose which of the two profiles they would vote for.  One candidate is drawn from the model for Labour candidates and the other one from the model for Conservative candidates.  We independently randomise whether each respondent sees party labels or not.

Examples of the task with and without party labels can be seen in Figure \@ref(fig:PromptChunk1Exp3). The order of the characteristics was randomized within three blocks. The first block consisted of the candidate's age and sex. The second block consisted of whether the candidate is from the constituency he/she is running for, whether the candidate has experience in local council, their position on the left-right spectrum, and their vote in the 2016 EU referendum. Finally, the third block consisted of the candidates' positions on 4 broad policy issues: spending cuts to local services, measures to protect the environment, redistribution of income, and the economic effects of immigration. We also randomize which candidate (Labour and Conservative) is visually on the left and on the right.

This method is closely related to traditional conjoint experiments; however, instead of a distribution where profile attributes are independently randomised, we have randomly selected complete profiles following their estimated distribution in the population of candidates. An external benchmark for the distribution of conjoint experiments is often used to increase the external validity of these experiments [for examples of its use in political science and a recount on the implications of this method see @bansak2020conjoint]. Often these benchmarks take the simple form of omitting impossible or unlikely combinations of attributes. By construction, the AMCE, the traditional estimate of causal relationship in conjoint experiments, is the result of averaging over the joint distribution of the presented profile [@hainmueller2014causal]. Therefore, the choice of treatment distribution is not innocuous. Relative to a conjoint experiment with independent randomisation of all elements of the candidate profiles, using an external benchmark for the distribution helps with external validity of estimates, but implies we cannot use non-parametric identification of causal effects of individual attributes (AMCEs), introducing model dependence when examining these effects [@delacuesta2019improving]. 

This experiment allows us to estimate some design-based causal estimates and some model-based estimates. We can calculate a design-based estimate of the effect of presenting party labels on respondents' choice, on average over the distribution of candidate characteristics that we sampled from.  The revelation of the party label is assigned randomly and independently of any other attribute, so we can simply compare averages of the two conditions of the experiment (with and without party labels) to estimate the relevant causal effect.  Furthermore, these estimates are the result of realistic electoral matches (benchmarked on the distribution of candidates) and therefore conserve the external validity of a realistic treatment distribution of the candidates' profiles. As @hainmueller2014causal explain, together with the AMCEs, conjoint experiments allow for the estimation of the average effect of complete profiles. This quantity is "[t]he expected difference in responses for two different sets of profiles" (p.10). This quantity is rarely of interest, because complete profiles are usually not substantively meaningful for conjoint experiments. However, following @hainmueller2014causal, this quantity is relevant if "the treatments correspond to two alternative scenarios that might happen in an actual election" (p.10).  This is the case in our experiment because we have benchmarked our treatment in the real distribution of candidates. While we are not interested in the causal effect of any specific profile of a candidate, we are interested in presenting the effect of a realistic set of electoral matches, with and without party labels, on respondents' choice between draws from the Labour candidate distribution and the Conservative candidate distribution.

The cost of randomising the attributes at the full profile level, rather than the individual attribute level, is that comparing differences in mean responses for particular attribute levels loses its causal interpretation.  These are no longer unbiased estimates of an AMCE because, without independent randomisation of attributes, the distribution of other attributes is not the same, conditional on particular levels of any given attribute.  We can, nonetheless, form model-based rather than design-based estimates of the causal effects of respondents seeing particular attribute levels, through the use of regression.  We can assess the causal effects of different attributes appearing in the treatment candidates, subject to modelling assumptions about how the effects of different attributes aggregate and heterogeneity in the population. For the purposes of this experiment, it makes sense to sacrifice having simple experimental comparisons for all attributes in exchange for having a meaningful external benchmark.  The random selection of candidate profiles still rules out familiar risks to causal inference that exist in regression analyses of observational data that would induce selection bias, such as the various candidate selection and positioning mechanisms by which candidates observed and unobserved characteristics adapt to a specific constituency.

```{r PromptChunk1Exp3, echo=FALSE,out.width="68%",out.height="48%",fig.cap="Survey prompts for experiment with example profiles. Without party labels (top) and with party labels (bottom)",fig.show='hold',fig.align='center', fig.pos="H"}
knitr::include_graphics(c("prompt1.png","prompt2.png"))
```

The survey was fielded by *YouGov* in October 2021. Each respondent faced five iterations of the experiment with the same party visibility condition. There were 808 respondents in the experimental condition with visible party affiliation and 828 without visible party affiliation.  The respondents came from the British Elections Study online panel, which means that the information on respondents (demographic characteristics, issue positions, and past votes) were obtained months or years before the experiment was implemented.

For purposes of data analysis, the choice of the respondent for task $i$, the outcome of interest, $c_i$, is coded with $1$ indicating that the respondent chose Candidate $A$, $-1$ indicating that the respondent chose Candidate $B$, and $0$ that the person chose "not sure" or "would not vote".  Candidate $A$ is the candidate presented on the left, candidate $B$ is the candidate presented on the right, and whether the Labour or the Conservative candidates is on the left or on the right is randomised for each candidate choice with equal probability.

The specifications of the explanatory variables are designed to measure both an average effect of candidate attributes and an effect that relates covariation of the candidate's attributes and of the respondent's own attributes.  The average effect is captured by a variable, $f_{ij} = x_{ijA} - x_{ijB}$, which reflects the difference between candidate $A$ and candidate $B$ on attribute $j$ for task $i$.  So, for example, if there is a general, average preference among respondents for a given characteristic, this specification ensures that this leads to a preference for candidate A when candidate A has that attribute and B does not, and an equal and opposite preference for candidate B when candidate B has that attribute and A does not.

But we are not just interested in which attributes are generally preferred, we are interested in the extent to which respondents chose candidates because those candidates are "closer" to the respondent, compared to the other alternative candidate. Thus, we form two variables, $m_{ijA} = \left|x_{ijA} - x_{ij} \right|$ and $m_{ijB} = \left|x_{ijB} - x_{ijR} \right|$ that capture the distance from the attribute $j$ of the respondent who completed task $i$, $x_{ij}$, to each of the candidates $A$ and $B$ that the respondent saw in that task. The difference between these two distances is then the explanatory variable of interest that enters our model for the candidate choice: $d_{ij} = m_{ijB} - m_{ijA}$. If, for task $i$, the two profiles are equally close to the respondent on attribute $j$, then $d_{ij}$ will be zero. If the distance variable is larger to Candidate A, then $d_{ij}$ will be negative, indicating that the candidate is closer to Candidate B; if the reverse is true, than $d_{ij}$ will be positive.  We would expect respondents to prefer more similar candidates, and thus for coefficients on the $d_{ij}$ to be positive.   

The reason the data are coded this way is so that relative closeness to A or to B, versus the other, are treated symmetrically.  Each coefficient describes the effect of moving closer to the chosen candidate for a single characteristic, holding the other attributes and the other profile constant.  Variables where there is not a respondent position, such as candidates' experience as local councillor and whether the candidate was born in the constituency only enter the model if the $f_{ij}$ form, which means that they are "valence" variables that are assumed to either help or hurt candidate for all respondents.  With these variables, the following subsections will examine how predictive $f_{ij}$ and $d_{ij}$ are, for each attribute $j$ in explaining the respondents' choice ($c_i$) and how this relationship changes with the inclusion and exclusion of party labels.

## Consistency with past party vote in the 2019 general election

```{r CorrectVoteCalculation, include=FALSE}
Data_Exp1 <- Data_Exp1 %>%
  mutate(past_vote_2019_Respondent = fct_recode(as.factor(past_vote_2019_Respondent),
                                "Conservative" = "1",
                                       "Labour" = "2",
                             "Liberal Democrat" = "3",
                 "Scottish National Party (SNP)" = "4",
                                  "Plaid Cymru" = "5",
                                  "Green Party" = "7",
                                        "Other" = "9",
                                 "Brexit Party" = "12",
                     "An independent candidate" = "13"),
         Past_vote_2019_Lab_or_Con = scale(case_when(
               past_vote_2019_Respondent == "Conservative" ~ 1,
               past_vote_2019_Respondent == "Labour" ~ -1,
               TRUE ~ 0))
  )
ConVoteByPastAndLabel <- Data_Exp1 %>%
  mutate(
    qsplit = fct_recode(as.factor(qsplit), "1" = "Party Label", "2" = "No Party Label"),
    past_vote_2019_Respondent =
      fct_other(as.factor(past_vote_2019_Respondent),
                          keep = c("Conservative","Labour","Brexit Party"),
                          other_level = 'Other')
                ) %>%
  mutate(Cons = chosen_CandidateN==1) %>%
  group_by(past_vote_2019_Respondent, qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(Cons ~ 1, data =., w =pull(., W8))),
            results = map(fit, broom::tidy)) %>%
  unnest(results) %>%
  select(-fit)

P.CorrectVoteCon <- ggplot(data = filter(ConVoteByPastAndLabel, !is.na(past_vote_2019_Respondent)) , aes(x = estimate, y = past_vote_2019_Respondent, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5) +
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  theme_clean()

##Labour
LabVoteByPastAndLabel <- Data_Exp1 %>%
  mutate(
    qsplit = fct_recode(as.factor(qsplit), "1" = "Party Label", "2" = "No Party Label"),
    past_vote_2019_Respondent =
      fct_other(as.factor(past_vote_2019_Respondent),
                          keep = c("Conservative","Labour","Brexit Party"),
                          other_level = 'Other')
                )   %>%
  mutate(Lab = chosen_CandidateN==-1) %>%
  group_by(past_vote_2019_Respondent, qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(Lab ~ 1, data =., w =pull(., W8))),
            results = map(fit, broom::tidy)) %>%
  unnest(results) 

P.CorrectVoteLab <- ggplot(data = filter(LabVoteByPastAndLabel, !is.na(past_vote_2019_Respondent)) , aes(x = estimate, y = past_vote_2019_Respondent, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5) +
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  theme_clean()


#Unsure or neither

NoneVoteByPastAndLabel <- Data_Exp1 %>%
  mutate(
    qsplit = fct_recode(as.factor(qsplit), "1" = "Party Label", "2" = "No Party Label"),
    past_vote_2019_Respondent =
      fct_other(as.factor(past_vote_2019_Respondent),
                          keep = c("Conservative","Labour","Brexit Party"),
                          other_level = 'Other')
                )  %>%
  mutate(None = chosen_CandidateN==0) %>%
  group_by(past_vote_2019_Respondent, qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(None ~ 1, data =., w =pull(., W8))),
            results = map(fit, broom::tidy)) %>%
  unnest(results) 

#Combine
CorrectVote_Con<-ConVoteByPastAndLabel%>%
  dplyr::select(
    "past_vote2019"=past_vote_2019_Respondent, "Labels" = qsplit, "Proportion" = estimate, "Std_Erro"=std.error
  )%>%
  mutate(
    Chosen_Candidates = "Conservative Candidate"
  )
CorrectVote_Lab<-LabVoteByPastAndLabel%>%
  dplyr::select(
    "past_vote2019"=past_vote_2019_Respondent, "Labels" = qsplit, "Proportion" = estimate, "Std_Erro"=std.error
  )%>%
  mutate(
    Chosen_Candidates = "Labour Candidate"
  )

CorrectVote_None<-NoneVoteByPastAndLabel%>%
  dplyr::select(
    "past_vote2019"=past_vote_2019_Respondent, "Labels" = qsplit, "Proportion" = estimate, "Std_Erro"=std.error
  )%>%
  mutate(
    Chosen_Candidates = "None"
  )

CorrectVote <- rbind(CorrectVote_Con,CorrectVote_Lab,CorrectVote_None) %>%
  drop_na()

ggplot(CorrectVote, aes(x= Labels, y=Proportion, fill = Chosen_Candidates))+
  geom_col(position =position_stack())+
  facet_grid( ~past_vote2019)+
  scale_fill_manual(values= c("#0087DC", "#E4003B", "cornsilk4"))+
  theme_clean()
#+ theme(panel.margin = grid::unit(-1.25, "lines"))

CorrectVote<-CorrectVote%>%
  mutate(
    past_vote2019 =
      fct_recode(past_vote2019, "Conservative Voters" = "Conservative","Labour Voters" = "Labour","Brexit Party Voters" = "Brexit Party")
  )%>%
  mutate(Chosen_Candidates = fct_recode(Chosen_Candidates, "Not sure or Not vote" = "None"),
         Chosen_Candidates = fct_relevel(Chosen_Candidates,"Not sure or Not vote","Labour Candidate","Conservative Candidate")
         )

P.CorrectVote2 <- ggplot(CorrectVote , aes(x = Proportion, y = Chosen_Candidates, col = Labels))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = Proportion-2*Std_Erro, xmax = Proportion+2*Std_Erro), width = 0.3) +
  facet_wrap(~past_vote2019)+
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  coord_cartesian(xlim = c(0,1))+
  theme_clean()+
  theme(panel.background = element_rect(fill = NA, color = "black"))

## Same analysis for 2017

Data_Exp1 <- Data_Exp1 %>%
  mutate(past_vote_2017_Respondent = fct_recode(as.factor(past_vote_2017_Respondent),
                                                "Conservative" = "1",
                                                "Labour" = "2",
                                                "Liberal Democrat" = "3",
                                                "Scottish National Party (SNP)" = "4",
                                                "Plaid Cymru" = "5",
                                                "Green Party" = "7",
                                                "Other" = "9",
                                                "Brexit Party" = "12",
                                                "An independent candidate" = "13"),
         Past_vote_2017_Lab_or_Con = case_when(
           past_vote_2017_Respondent == "Conservative" ~ 1,
           past_vote_2017_Respondent == "Labour" ~ -1,
           TRUE ~ 0)
  )

ConVoteByPastAndLabel2017 <- Data_Exp1 %>%
  mutate(
    qsplit = fct_recode(as.factor(qsplit), "1" = "Party Label", "2" = "No Party Label"),
    past_vote_2017_Respondent =
      fct_other(as.factor(past_vote_2017_Respondent),
                          keep = c("Conservative","Labour"),
                          other_level = 'Other')
                ) %>%
  mutate(Cons = chosen_CandidateN==1) %>%
  group_by(past_vote_2017_Respondent, qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(Cons ~ 1, data =., w =pull(., W8))),
            results = map(fit, broom::tidy)) %>%
  unnest(results) 

P.CorrectVoteCon <- ggplot(data = filter(ConVoteByPastAndLabel2017, !is.na(past_vote_2017_Respondent)) , aes(x = estimate, y = past_vote_2017_Respondent, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5) +
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  theme_clean()

##Labour
LabVoteByPastAndLabel2017 <- Data_Exp1 %>%
  mutate(
    qsplit = fct_recode(as.factor(qsplit), "1" = "Party Label", "2" = "No Party Label"),
    past_vote_2017_Respondent =
      fct_other(as.factor(past_vote_2017_Respondent),
                          keep = c("Conservative","Labour"),
                          other_level = 'Other')
                )   %>%
  mutate(Lab = chosen_CandidateN==-1) %>%
  group_by(past_vote_2017_Respondent, qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(Lab ~ 1, data =., w =pull(., W8))),
            results = map(fit, broom::tidy)) %>%
  unnest(results) 

P.CorrectVoteLab <- ggplot(data = filter(LabVoteByPastAndLabel2017, !is.na(past_vote_2017_Respondent)) , aes(x = estimate, y = past_vote_2017_Respondent, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5) +
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  theme_clean()


#Unsure or neither

NoneVoteByPastAndLabel2017 <- Data_Exp1 %>%
  mutate(
    qsplit = fct_recode(as.factor(qsplit), "1" = "Party Label", "2" = "No Party Label"),
    past_vote_2017_Respondent =
      fct_other(as.factor(past_vote_2017_Respondent),
                          keep = c("Conservative","Labour"),
                          other_level = 'Other')
                )  %>%
  mutate(None = chosen_CandidateN==0) %>%
  group_by(past_vote_2017_Respondent, qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(None ~ 1, data =., w =pull(., W8))),
            results = map(fit, broom::tidy)) %>%
  unnest(results) 

#Combine
CorrectVote_Con2017<-ConVoteByPastAndLabel2017%>%
  dplyr::select(
    "past_vote2017"=past_vote_2017_Respondent, "Labels" = qsplit, "Proportion" = estimate, "Std_Erro"=std.error
  )%>%
  mutate(
    Chosen_Candidates = "Conservative Candidate"
  )
CorrectVote_Lab2017<-LabVoteByPastAndLabel2017%>%
  dplyr::select(
    "past_vote2017"=past_vote_2017_Respondent, "Labels" = qsplit, "Proportion" = estimate, "Std_Erro"=std.error
  )%>%
  mutate(
    Chosen_Candidates = "Labour Candidate"
  )

CorrectVote_None2017<-NoneVoteByPastAndLabel2017%>%
  dplyr::select(
    "past_vote2017"=past_vote_2017_Respondent, "Labels" = qsplit, "Proportion" = estimate, "Std_Erro"=std.error
  )%>%
  mutate(
    Chosen_Candidates = "None"
  )

CorrectVote2017 <- rbind(CorrectVote_Con2017,CorrectVote_Lab2017,CorrectVote_None2017) %>%
  drop_na()

ggplot(CorrectVote2017, aes(x= Labels, y=Proportion, fill = Chosen_Candidates))+
  geom_col(position =position_stack())+
  facet_grid( ~past_vote2017)+
  scale_fill_manual(values= c("#0087DC", "#E4003B", "cornsilk4"))+
  theme_clean()
#+ theme(panel.margin = grid::unit(-1.25, "lines"))

CorrectVote2017<-CorrectVote2017%>%
  mutate(
    past_vote2017 =
      fct_recode(past_vote2017, "Conservative Voters" = "Conservative","Labour Voters" = "Labour")
  )%>%
  mutate(Chosen_Candidates = fct_recode(Chosen_Candidates, "Not sure or Not vote" = "None"),
         Chosen_Candidates = fct_relevel(Chosen_Candidates,"Not sure or Not vote","Labour Candidate","Conservative Candidate")
         )

P.CorrectVote2017 <- ggplot(CorrectVote2017 , aes(x = Proportion, y = Chosen_Candidates, col = Labels))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = Proportion-2*Std_Erro, xmax = Proportion+2*Std_Erro), width = 0.3) +
  facet_wrap(~past_vote2017)+
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  coord_cartesian(xlim = c(0,1))+
  theme_clean()+
  theme(panel.background = element_rect(fill = NA, color = "black"))
```

Our experiment allows us to assess how much the provision of party labels increases the consistency of candidate choice in the experiment with past vote choice, in the context of providing a range of realistically distributed information about candidate positions and other attributes.  We can do this without detailing the effect each individual attribute had, and, therefore, without requiring modelling assumptions. Figure \@ref(fig:Correctvote) shows the proportion of respondents that chose each candidate by their vote in the 2019 general election.[^2017b] [^PIDb] The results suggest that, without party labels, 2019 Labour and Conservative voters maintained their 2019 vote choices at different rates. `r round(ConVoteByPastAndLabel[2,4],3)*100`% of respondents that previously voted for Conservative chose the Conservative profile, in the absence of party label. The remaining 2019 Conservative voters either chose a Labour candidate (`r round(CorrectVote[10,"Proportion"],3)*100`%) or the "not sure" and "not vote" options (`r round(CorrectVote[18,"Proportion"],3)*100`%). The percentage of 2019 Conservative voters choosing the Conservative candidate in the experiment increases to `r round(ConVoteByPastAndLabel[1,4],3)*100`% when party labels are given, thanks to fewer 2019 Conservative voters choosing a Labour Candidate (`r round(CorrectVote[9,"Proportion"],3)*100`%) and fewer choosing "not sure" and "not vote" options (`r round(CorrectVote[17,"Proportion"],3)*100`%).

The effect of party labels for choosing a Conservative candidate is especially noticeable for Brexit party voters. When labels were not given, only `r round(CorrectVote[6,"Proportion"],3)*100`% of these respondents chose a Conservative candidate, and `r round(CorrectVote[5,"Proportion"],3)*100`% when party labels were made available. This important difference comes from voters that do not choose any of the candidates when party labels are omitted. This could be because these voters tend to be interested in policies that are not included in the experiment, and are using party affiliation as a proxy of candidates´ positions on these issues, or because these voters tend to much prefer Conservatives to Labour candidates because of the party labels as such. Under either explanation, the very large effect suggests that these voters are less interested in or able to guess candidates’ party affiliation.

[^2017b]: The same analysis is carried out in Figure A4 in the online appendix with voters in the 2017 general elections. The patterns observed for Labour and Conservative voters remain largely the same.

[^PIDb]: The same analysis is carried out in Figure A7 in the online appendix with respondents' party identification. The patterns observed for Labour and Conservative identifiers remain largely the same.The effect of party labels is now significant for Labour identifiers, but minimally.

By comparison, `r round(LabVoteByPastAndLabel[4,5],3)*100`% of respondents that voted for Labour in 2019 chose the Labour profile in the absence of party label. The fact that this is much higher than for 2019 Conservatives voting Conservative in our experiment is not necessarily notable, as it reflects a shift in overall support for the parties versus the 2019 election at the time of the experiment. What is more notable is that this percentage is not significantly lower than the `r round(LabVoteByPastAndLabel[3,5],3)*100`% who chose the Labour profile when party labels are given. Only `r round(ConVoteByPastAndLabel[4,4],3)*100`% Labour voters chose the Conservative profile when labels where not given, and this proportion decreased to `r round(ConVoteByPastAndLabel[3,4],3)*100`% when party affiliation of profiles were made explicit. The percentage of past Labour voters that chose either the "not sure" or "not vote" options changed insignificantly from `r round(CorrectVote[20,"Proportion"],3)*100`%, when labels were not given, to `r round(CorrectVote[19,"Proportion"],3)*100`% with party labels.

While Conservative voters were significantly and substantially affected by the presence of party labels, Labour voters were less sensitive to explicit party cues. This might suggest that 2019 Labour voters are more aligned with Labour candidates' positions and attributes than are 2019 Conservative voters with Conservative candidates, and therefore making party labels explicit has little effect on them.  It could also be that the set of candidate positions and attributes provided better captured the reasons why Labour voters vote Labour than the reasons why Conservative voters vote Conservative.  It is also possible that Labour voters are better at "guessing" the party affiliation of candidates.  These mechanisms could reflect the particular moment of the survey: the fact that the 2019 election saw a relatively strong result for the Conservatives relative to Labour meant that loosely attached, swing voters would have disproportionately voted Conservative in that election.  These voters could be less attached to their most recent vote on the basis of their positions, could be selecting parties for reasons beyond the classic differentiating issues between the parties, and/or could be less able to guess party positions than the core vote of either major party. 

```{r Correctvote, fig.width=9,fig.height=8,out.width="\\linewidth", echo=FALSE, fig.cap= 'Proportion of respondents that chose each candidate in the experiment by their vote in the 2019 general election. In each graph of the panel, the horizontal axis represents the proportion of respondents that chose either the Conservative candidate, the Labour candidate or the "Not sure" and "Not vote" options. In the top-left graphic, proportions are shown for respondents that voted for the Conservative party in 2019. In  the top-right graph, former Labour voters are presented. In the bottom-left graph former Brexit party voters are presented. Finally, in the bottom right graph, we present the proportions for respondents that did not vote for any of the mentioned three parties.', fig.show='hold', fig.align='center', fig.pos="H"}

P.CorrectVote2  

```

## How clear a signal of party do other characteristics provide?

```{r ClosenessCalculation, include=FALSE}

library(modelr)

Data_Exp1 <-   Data_Exp1 %>%
  mutate(
  euRefVote_Respondent = na_if(euRefVote_Respondent, 2)
  )%>%
  mutate(
    Sex_Closeness= abs(Sex_Lab_Profile-gender_Respondent) - abs(Sex_Con_Profile-gender_Respondent),
    Brexit_Closeness = abs(Brexit_Lab_Profile-euRefVote_Respondent) - abs(Brexit_Con_Profile-euRefVote_Respondent),
    LRD_Closeness =  abs(LR_Lab_Profile - leftRight_Respondent)- abs(LR_Con_Profile - leftRight_Respondent),
    BornConst_Closeness= BornConst_Con_Profile - BornConst_Lab_Profile,
    Age_Closeness =  abs(Age_Lab_Profile - age_respondent) - abs(Age_Con_Profile - age_respondent),
    CutsSpending_Closeness = abs(CutsSpending_Lab_Profile - cutsTooFar_Respondent) - abs(CutsSpending_Con_Profile-cutsTooFar_Respondent),
    Environment_Closeness = abs(Environment_Lab_Profile - enviroProtection_Respondent) -  abs(Environment_Con_Profile -enviroProtection_Respondent),
    Redistribution_Closeness = abs(Redistribution_Lab_Profile - redist_Respondent) - abs(Redistribution_Con_Profile - redist_Respondent),
    Immigration_Closeness = abs(ImmigrationEcon_Lab_Profile - immigEcon_Respondent) - abs(ImmigrationEcon_Con_Profile - immigEcon_Respondent),
    ExperienceCouncil_Closeness = ExperienceCouncil_Con_Profile - ExperienceCouncil_Lab_Profile
  )

VoteCorrectByLabel <- Data_Exp1 %>%
    filter(past_vote_2019_Respondent %in% c("Conservative","Labour")) 
VoteCorrectByLabel <-VoteCorrectByLabel %>%
  mutate(qsplit = dplyr::recode(as.factor(qsplit), "1" = "Party Label", "2" = "No Party Label"),
         past_vote_2019 = fct_relevel(past_vote_2019_Respondent,"Labour","Conservative")) %>%
  group_by(qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(chosen_CandidateN ~
                                  Sex_Closeness
                                + Brexit_Closeness
                                + scale(LRD_Closeness)
                                + BornConst_Closeness
                                + Age_Closeness
                                + scale(CutsSpending_Closeness)
                                + scale(Environment_Closeness)
                                + scale(Redistribution_Closeness)
                                + scale(Immigration_Closeness)
                                + ExperienceCouncil_Closeness, data =., w =pull(., W8))),
#            results = map(fit, effectsize::standardize_parameters),
            results = map(fit, broom::tidy)
                          ) %>%
  unnest(results) %>%
  mutate(
    across(everything(), ~labelled::remove_labels(.x))) %>%
  dplyr::select(qsplit, term, estimate, std.error)

VoteCorrectByLabel <- VoteCorrectByLabel %>%
  mutate(
    term = fct_recode(as.factor(term),
                      "Sex"="Sex_Closeness","Age"="Age_Closeness" ,"Born in Constituency"="BornConst_Closeness","Brexit"="Brexit_Closeness" ,
                       "Experience in Council"= "ExperienceCouncil_Closeness","Left-Right"="scale(LRD_Closeness)","Spending Cuts" = "scale(CutsSpending_Closeness)","Environment"="scale(Environment_Closeness)",
                       "Immigration"="scale(Immigration_Closeness)","Redistribution"="scale(Redistribution_Closeness)"
                      )
  )
P.Closeness <- VoteCorrectByLabel %>%
  filter(!term == "(Intercept)" ) %>%
  mutate(
    term = fct_relevel(term,
                       "Sex","Age","Brexit","Born in Constituency",
                       "Experience in Council","Left-Right","Spending Cuts","Environment",
                       "Immigration","Redistribution")
  )%>%
ggplot( aes(x = estimate, y = term, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5) +
  geom_vline(xintercept=0, linetype="dashed", 
             size=0.5, color="blue", alpha=0.5)+
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  coord_cartesian(xlim = c(-0.2,1.3))+
    ggtitle("Closeness of candidates’ positions to respondents’ positions\nas predictors of candidate choice\nNot controlling for matching party affiliation")+
  theme_clean()

VoteCorrectByLabel2019 <- Data_Exp1 %>%
  filter(past_vote_2019_Respondent %in% c("Conservative","Labour")) %>%
  mutate(qsplit = fct_recode(as.factor(qsplit), "Party Label"="1", "No Party Label"="2"),
         past_vote_2019 = as.numeric(fct_relevel(past_vote_2019_Respondent,"Labour","Conservative"))) %>%
  group_by(qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(chosen_CandidateN ~
                                  Sex_Closeness
                                + Brexit_Closeness
                                + scale(LRD_Closeness)
                                + BornConst_Closeness
                                + Age_Closeness
                                + scale(CutsSpending_Closeness)
                                + scale(Environment_Closeness)
                                + scale(Redistribution_Closeness)
                                + scale(Immigration_Closeness)
                                + ExperienceCouncil_Closeness 
                                + Past_vote_2019_Lab_or_Con, data =., w =pull(., W8))),
            results = map(fit, broom::tidy)) %>%
  unnest(results)%>%
  select(-fit)

VoteCorrectByLabel2019 <- VoteCorrectByLabel2019 %>%
  mutate(
    term = fct_recode(as.factor(term),
                      "Sex"="Sex_Closeness","Age"="Age_Closeness" ,"Born in Constituency"="BornConst_Closeness","Brexit"="Brexit_Closeness" ,
                       "Experience in Council"= "ExperienceCouncil_Closeness","Left-Right"="scale(LRD_Closeness)","Spending Cuts" = "scale(CutsSpending_Closeness)","Environment"="scale(Environment_Closeness)",
                       "Immigration"="scale(Immigration_Closeness)","Redistribution"="scale(Redistribution_Closeness)"
                      )
  )

P.Closeness_Pastvote2019 <- VoteCorrectByLabel2019 %>%
  filter(!term == "(Intercept)" ) %>%
  mutate(
    term = fct_recode(as.factor(term),"Past Party Vote 2019" ="Past_vote_2019_Lab_or_Con"),
    term = fct_relevel(term, "Past Party Vote 2019",
                       "Sex","Age","Brexit","Born in Constituency",
                       "Experience in Council","Left-Right","Spending Cuts","Environment",
                       "Immigration","Redistribution")
  )%>%
  ggplot( aes(x = estimate, y = term, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5)+
  geom_vline(xintercept=0, linetype="dashed", 
             size=0.5, color="blue", alpha=0.5)+
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  coord_cartesian(xlim = c(-0.2,1.3))+
  ggtitle("Closeness of candidates’ positions to respondents’ positions\nas predictors of candidate choice\nControlling for matching party affiliation")+
  theme_clean()

## Same analysis for 2017


VoteCorrectByLabel <- Data_Exp1 %>%
  filter(past_vote_2017_Respondent %in% c("Conservative","Labour")) 
VoteCorrectByLabel <-VoteCorrectByLabel %>%
  mutate(qsplit = fct_recode(as.factor(qsplit),  "Party Label"="1",  "No Party Label" = "2")) %>%
  group_by(qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(chosen_CandidateN ~
                                         Sex_Closeness
                                       + Brexit_Closeness
                                       + scale(LRD_Closeness)
                                       + BornConst_Closeness
                                       + Age_Closeness
                                       + scale(CutsSpending_Closeness)
                                       + scale(Environment_Closeness)
                                       + scale(Redistribution_Closeness)
                                       + scale(Immigration_Closeness)
                                       + ExperienceCouncil_Closeness, data =., w =pull(., W8))),
                   #            results = map(fit, effectsize::standardize_parameters),
                   results = map(fit, broom::tidy)
  ) %>%
  unnest(results)

VoteCorrectByLabel <- VoteCorrectByLabel %>%
  mutate(
    term = fct_recode(as.factor(term),
                      "Sex"="Sex_Closeness","Age"="Age_Closeness" ,"Born in Constituency"="BornConst_Closeness","Brexit"="Brexit_Closeness" ,
                      "Experience in Council"= "ExperienceCouncil_Closeness","Left-Right"="scale(LRD_Closeness)","Spending Cuts" = "scale(CutsSpending_Closeness)","Environment"="scale(Environment_Closeness)",
                      "Immigration"="scale(Immigration_Closeness)","Redistribution"="scale(Redistribution_Closeness)"
    )
  )
P.Closeness2017 <- VoteCorrectByLabel %>%
  filter(!term == "(Intercept)" ) %>%
  mutate(
    term = fct_relevel(term,
                       "Sex","Age","Brexit","Born in Constituency",
                       "Experience in Council","Left-Right","Spending Cuts","Environment",
                       "Immigration","Redistribution")
  )%>%
  ggplot( aes(x = estimate, y = term, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5) +
  geom_vline(xintercept=0, linetype="dashed", 
             size=0.5, color="blue", alpha=0.5)+
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  coord_cartesian(xlim = c(-0.2,1.3))+
  theme_clean()

VoteCorrectByLabel2017 <- Data_Exp1 %>%
  filter(past_vote_2017_Respondent %in% c("Conservative","Labour")) %>%
  mutate(qsplit = fct_recode(as.factor(qsplit), "Party Label"="1", "No Party Label"="2")) %>%
  group_by(qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(chosen_CandidateN ~
                                         Sex_Closeness
                                       + Brexit_Closeness
                                       + scale(LRD_Closeness)
                                       + BornConst_Closeness
                                       + Age_Closeness
                                       + scale(CutsSpending_Closeness)
                                       + scale(Environment_Closeness)
                                       + scale(Redistribution_Closeness)
                                       + scale(Immigration_Closeness)
                                       + ExperienceCouncil_Closeness 
                                       + Past_vote_2017_Lab_or_Con, data =., w =pull(., W8))),
                   results = map(fit, broom::tidy)) %>%
  unnest(results)

VoteCorrectByLabel2017 <- VoteCorrectByLabel2017 %>%
  mutate(
    term = fct_recode(as.factor(term),
                      "Sex"="Sex_Closeness","Age"="Age_Closeness" ,"Born in Constituency"="BornConst_Closeness","Brexit"="Brexit_Closeness" ,
                      "Experience in Council"= "ExperienceCouncil_Closeness","Left-Right"="scale(LRD_Closeness)","Spending Cuts" = "scale(CutsSpending_Closeness)","Environment"="scale(Environment_Closeness)",
                      "Immigration"="scale(Immigration_Closeness)","Redistribution"="scale(Redistribution_Closeness)"
    )
  )

P.Closeness_Pastvote2017 <- VoteCorrectByLabel2017 %>%
  filter(!term == "(Intercept)" ) %>%
  mutate(
    term = fct_recode(as.factor(term),"Past Party Vote 2017" ="Past_vote_2017_Lab_or_Con"),
    term = fct_relevel(term, "Past Party Vote 2017",
                       "Sex","Age","Brexit","Born in Constituency",
                       "Experience in Council","Left-Right","Spending Cuts","Environment",
                       "Immigration","Redistribution")
  )%>%
  ggplot( aes(x = estimate, y = term, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5)+
  geom_vline(xintercept=0, linetype="dashed", 
             size=0.5, color="blue", alpha=0.5)+
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  coord_cartesian(xlim = c(-0.2,1.3))+
  theme_clean()




```

```{r ClosenessRelativeCons, include=FALSE}
##Means

PositionsProfile <- Data_Exp1 %>%
  dplyr::select(
         ImmigrationEcon_Profile.Conservative = ImmigrationEcon_Con_Profile,
         ImmigrationEcon_Profile.Labour = ImmigrationEcon_Lab_Profile,
         CutsSpending_Profile.Conservative = CutsSpending_Con_Profile,
         CutsSpending_Profile.Labour = CutsSpending_Lab_Profile, LR_Profile.Labour = LR_Lab_Profile,
         LR_Profile.Conservative = LR_Con_Profile,
        Environment_Profile.Conservative = Environment_Con_Profile,
         Environment_Profile.Labour = Environment_Lab_Profile,
         Brexit_Profile.Labour = Brexit_Lab_Profile, Brexit_Profile.Conservative = Brexit_Con_Profile,
          Redistribution_Profile.Conservative = Redistribution_Con_Profile,
         Redistribution_Profile.Labour = Redistribution_Lab_Profile, W8) %>%
  gather("key", "value", ImmigrationEcon_Profile.Conservative:Redistribution_Profile.Labour) %>%
  separate(key, into = c("Issue", "Individual", "Party")) %>%
  dplyr::select(W8, Party, Issue, Individual, value)

PositionsRespondent <- Data_Exp1 %>%
  dplyr::select(ImmigrationEcon_Respondent = immigEcon_Respondent,
         CutsSpending_Respondent = cutsTooFar_Respondent,
         Redistribution_Respondent = redist_Respondent,
         LR_Respondent = leftRight_Respondent,
         Environment_Respondent = enviroProtection_Respondent,
         Environment_Profile.Lab = Environment_Lab_Profile,
         Brexit_Respondent = euRefVote_Respondent, W8,
         Party = past_vote_2019_Respondent) %>%
  gather("key", "value", ImmigrationEcon_Respondent:Brexit_Respondent) %>%
  separate(key, into = c("Issue", "Individual")) %>%
  mutate(
    Party = recode(as.factor(Party),"1"= "Conservative", "2" = "Labour")) %>%
  filter(Party %in% c("Conservative", "Labour")) 

Positions<-rbind(PositionsProfile, PositionsRespondent)

Positions<- Positions %>%
  dplyr::mutate(
    value = case_when(
      Issue == "Brexit" & value == 2 ~ NA_real_,
      TRUE ~ as.numeric(value)
    )
  )

Mean_Positions <- Positions %>%
  group_by(Individual, Issue, Party)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(value ~ 1, data =., w =pull(., W8))),
            results = map(fit, broom::tidy)) %>%
  unnest(results) 

p.Relative_Positions <- ggplot(data = filter(Mean_Positions, Issue != "Brexit") , aes(x = estimate, y = Individual, col = Party))+
  geom_point()+
  geom_errorbar(width = 0.1,
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error)) +
  labs(title = "Positions of Voters and Candidates") +
  facet_wrap(~Issue)+
  scale_color_manual(values= c("#0087DC", "#E4003B"), label = c("Conservative","Labour"))+
  labs(x="",y="")+
  theme_bw()

Mean_Candidates <- Mean_Positions %>%
  filter(Individual == "Profile" & Issue %in% c("CutsSpending", "ImmigrationEcon")) %>% 
  dplyr::select(Issue, Party, estimate)


P.Conservatives_Distance <-ggplot(filter(Positions, Issue %in% c("CutsSpending", "ImmigrationEcon") & Individual == "Respondent" & Party == "Conservative"), aes(x = as.factor(value))) +
  geom_bar(aes(y = (..count..)/sum(..count..)))+
  geom_vline(data=Mean_Candidates, aes(xintercept = estimate, col=Party ), size = 1.5, linetype = "dashed", alpha = 0.5) +
#  geom_label(data=Mean_Candidates,aes(x = estimate, y = 0.2, label =paste0(Party, "\ncandidate\naverage")), size = #4 )+
  facet_wrap(~Issue, scales = "free_x")+
  scale_y_continuous(labels=percent) +
  theme_bw() +
  theme(strip.text = element_text(size=15))+
  coord_cartesian(ylim=c(0,0.20))+
  labs(x="",y="")+
   scale_color_manual(values= c("#0087DC", "#E4003B"), label = c("Conservative candidate average","Labour candidate average"))

Mean_Cuts_Respondent <- Positions %>%
  filter(Issue =="CutsSpending" & Individual == "Respondent" & Party == "Conservative") %>%
  mutate(Higher3 = value > 3) %>%
  dplyr::summarise(Percentage = weighted.mean(x = Higher3, w = W8, na.rm=T))  


Immigration_Respondent <- Positions %>%
  filter(Issue =="ImmigrationEcon" & Individual == "Respondent" & Party == "Conservative") %>%
  mutate(Higher5 = value > 5) %>%
  dplyr::summarise(Percentage = weighted.mean(x = Higher5, w = W8, na.rm=T)) 

#Closer Candidate per task
#If distance is positive than closer to Conservative candidate

## Brexit
Data_Exp1 <- Data_Exp1 %>%
  mutate(
    Closer_Con_Brexit = Brexit_Closeness > 0,
    Closer_Lab_Brexit = Brexit_Closeness < 0,
    Closer_Con_LR = LRD_Closeness>0,
    Closer_Lab_LR = LRD_Closeness<0,
    Closer_Con_CutsSpending = CutsSpending_Closeness>0,
    Closer_Lab_CutsSpending = CutsSpending_Closeness<0,
    Closer_Con_Immigration = Immigration_Closeness>0,
    Closer_Lab_Immigration = Immigration_Closeness<0,
    Closer_Con_Environment = Environment_Closeness>0,
    Closer_Lab_Environment = Environment_Closeness<0,
    Closer_Con_Redistribution = Redistribution_Closeness>0,
    Closer_Lab_Redistribution = Redistribution_Closeness<0
  )

#Create to tables. One for Conservative voters and one for Labour voters
CloserCandidateCon <- Data_Exp1 %>%
  group_by(past_vote_2019_Respondent)%>%
#  group_by(past_vote_2019_Respondent, qsplit)%>%
  dplyr::summarise(
    across(starts_with("Closer_"), ~sum(.x,na.rm = T)/n())
  ) %>%
  filter(past_vote_2019_Respondent =="Conservative")%>%
  t() %>%
  janitor::row_to_names(row_number = 1) %>%
  as.data.frame()%>%
  mutate(
    Conservative = paste0(as.character(round(as.numeric(Conservative), 3)*100),"%")
  )%>%
  rownames_to_column("Name")%>%
  separate(Name, into = c("Closer","Party", "Issue")) %>%
  dplyr::select(-Closer)%>%
  spread("Party","Conservative")%>%
  rename("Conservative candidate"= "Con", "Labour candidate"= "Lab") %>%
  column_to_rownames("Issue")

CloserCandidateConN <- Data_Exp1 %>%
  group_by(past_vote_2019_Respondent)%>%
#  group_by(past_vote_2019_Respondent, qsplit)%>%
  dplyr::summarise(
    across(starts_with("Closer_"), ~sum(.x,na.rm = T)/n())
  ) %>%
  filter(past_vote_2019_Respondent =="Conservative")%>%
  t() %>%
  janitor::row_to_names(row_number = 1) %>%
  as.data.frame()%>%
  rownames_to_column("Name")%>%
  separate(Name, into = c("Closer","Party", "Issue")) %>%
  dplyr::select(-Closer)%>%
  spread("Party","Conservative")%>%
  mutate_at(c("Con","Lab"),as.numeric)%>%
  rename("Conservative candidate"= "Con", "Labour candidate"= "Lab") %>%
  column_to_rownames("Issue")

CloserCandidateLab <- Data_Exp1 %>%
  group_by(past_vote_2019_Respondent)%>%
#  group_by(past_vote_2019_Respondent, qsplit)%>%
  dplyr::summarise(
    across(starts_with("Closer_"), ~sum(.x,na.rm = T)/n())
  ) %>%
  filter(past_vote_2019_Respondent =="Labour")%>%
  t() %>%
  janitor::row_to_names(row_number = 1) %>%
  as.data.frame()%>%
  mutate(
    Labour = paste0(as.character(round(as.numeric(Labour), 3)*100),"%")
  )%>%
  rownames_to_column("Name")%>%
  separate(Name, into = c("Closer","Party", "Issue")) %>%
  dplyr::select(-Closer)%>%
  spread("Party","Labour")%>%
  rename("Conservative candidate"= "Con", "Labour candidate"= "Lab")%>%
  column_to_rownames("Issue")

CloserCandidateLabN <- Data_Exp1 %>%
  group_by(past_vote_2019_Respondent)%>%
#  group_by(past_vote_2019_Respondent, qsplit)%>%
  dplyr::summarise(
    across(starts_with("Closer_"), ~sum(.x,na.rm = T)/n())
  ) %>%
  filter(past_vote_2019_Respondent =="Labour")%>%
  t() %>%
  janitor::row_to_names(row_number = 1) %>%
  as.data.frame()%>%
  rownames_to_column("Name")%>%
  separate(Name, into = c("Closer","Party", "Issue")) %>%
  dplyr::select(-Closer)%>%
  spread("Party","Labour")%>%
  mutate_at(c("Con","Lab"),as.numeric)%>%
  rename("Conservative candidate"= "Con", "Labour candidate"= "Lab")%>%
  column_to_rownames("Issue")

```

While the causal effect of party label for Conservatives is substantial for an experimental effect, the overall results still imply that most voters' choices do not change in the party label condition versus the no party label condition.  It appears that most respondents are able to identify preferred candidates based on their similarities, and this coincides with party preference.  Consequently, including or excluding party labels makes only a small difference.  This leads us to ask: how much closer are respondents to the candidate of the party they voted for in 2019, compared to the party they did not vote for?  How strong a signal do the other attributes provide?

Table \@ref(tab:ConCloser) shows, for every policy position, the proportion of Conservative voters that was faced with a Conservative candidate closer to their positions and the proportion that was faced with a Labour candidate closer to their positions (the remaining proportion chose between candidates equally distant to their positions). While it is true that, for every policy, the proportion of respondents that was closer to the Conservative candidate was larger, only for positions on the Left-Right spectrum did this proportion surpass 50%, as many voters are equidistant from the candidates they chose between on particular policies. The position on which 2019 Conservatives voters were closest to Labour candidates was on redistribution, where nearly as many were closer to the Labour candidate (`r round(CloserCandidateConN["Redistribution","Labour candidate"],3)*100`%) as were closer to the Conservative candidate (`r round(CloserCandidateConN["Redistribution","Conservative candidate"],3)*100`%).



```{r ClosenessRelativeLab, include=FALSE}
##Means
#Brexit> 0 is remain, 1 is Leave, 2 is not voted
Mean_Candidates_Lab <- Mean_Positions %>%
  filter(Individual == "Profile" & Issue %in% c("CutsSpending","Environment")) %>% 
  dplyr::select(Issue, Party, estimate)


P.Labour_Distance <-
  ggplot(filter(Positions, Issue %in% c("CutsSpending","Environment") & Individual == "Respondent" & Party =="Labour"), aes(x = as.factor(value))) +
  geom_bar(aes(y = (..count..)/sum(..count..)))+
  geom_vline(data=Mean_Candidates_Lab, aes(xintercept = estimate, col=Party ), size = 1.5, linetype = "dashed", alpha = 0.5) +
  facet_wrap(~Issue)+
  scale_y_continuous(labels=percent) +
  theme_bw() +
  theme(strip.text = element_text(size=15))+
  coord_cartesian(ylim=c(0,0.20))+
  labs(x="",y="")+
  scale_color_manual(values= c("#0087DC", "#E4003B"), label = c("Conservative candidate average","Labour candidate average"))

Mean_Cuts_Respondent_Lab <- Positions %>%
  filter(Issue =="CutsSpending" & Individual == "Respondent" & Party == "Labour") %>%
  mutate(Higher3 = value > 3) %>%
  dplyr::summarise(Percentage = weighted.mean(x = Higher3, w = W8, na.rm=T))

Mean_Environment_Respondent_Lab <- Positions %>%
  filter(Issue =="Environment" & Individual == "Respondent" & Party == "Labour") %>%
  mutate(Lower2 = value <= 2) %>%
  dplyr::summarise(Percentage = weighted.mean(x = Lower2, w = W8, na.rm=T))  


```


Similarly, in the case of Labour voters, Table \@ref(tab:LabCloser) shows that the proportion of respondents closer to Labour candidates also is above 50% for the left-right position.  However, in this case Redistribution has an even higher proportion of respondents closer to Labour candidates, with `r round(CloserCandidateLabN["Redistribution","Labour candidate"],3)*100`%. The position on which 2019 Labour voters differed the most from Labour candidates was on their position on immigration, where slightly more were closer to the Conservative candidate (`r round(CloserCandidateLabN["Immigration","Conservative candidate"],3)*100`%) than to the Labour candidate (`r round(CloserCandidateLabN["Immigration","Labour candidate"],3)*100`%).[^GraphExp]


```{r Closer, echo=FALSE, out.width="98%", results='asis',fig.show='hold',fig.align='center', fig.pos="H"}


  kable(CloserCandidateCon, caption = "\\label{tab:ConCloser}Conservative voters", booktabs = T)


  kable(CloserCandidateLab, caption = "\\label{tab:LabCloser}Labour voters", booktabs = T)%>%
  kableExtra::add_footnote(label=c("", "The tables present the proportion of respondents  2019 Conservative (top) and Labour (bottom) past voters whose positions are closer to the Conservative or Labour candidates they saw in each task"),notation = "none")
```

[^GraphExp]: Whenever a respondent is presented with two candidates, his or her position on each issue might be closer to the Conservative candidate or to the Labour candidate. The tables present, for each issue, the percentage of respondents whose position on the issue was closer to the Conservative candidate and the percentage of respondents whose position on the issue was closer to the Labour candidate (the same respondent can be closer to one candidate on one issue and closer to the other candidate on another issue). The table on the top presents these percentages for respondents that voted for Conservative in 2019, and the table on the bottom presents the percentages for respondents that voted Labour in  2019."

```{r ClosenessBrexit-LR, include=FALSE}
##Means
#Brexit> 0 is remain, 1 is Leave, 2 is not voted

#LR and Brexit

##LR

Mean_Candidates_Lab_LR <- Mean_Positions %>%
  filter(Individual == "Profile" & Issue %in% c("LR")) %>% 
  dplyr::select(Issue, Party, estimate)

P.Labour_Distance_LR <-
  ggplot(na.omit(filter(Positions, Issue %in% c("LR") & Individual == "Respondent" & Party =="Labour")), aes(x = value)) +
  geom_bar(aes(x= as.factor(value), y = (..count..)/sum(..count..)))+
  geom_vline(data=Mean_Candidates_Lab_LR, aes(xintercept = estimate+1, col=Party ), size = 1.5, linetype = "dashed", alpha = 0.5) +
  scale_y_continuous(labels=percent) +
  theme_bw() +
  theme(strip.text = element_text(size=15))+
  coord_cartesian(ylim=c(0,0.28))+
  scale_color_manual(values= c("#0087DC", "#E4003B"), label = c("Conservative candidate average","Labour candidate average"))+
  labs(x="",y="")+
  ggtitle("Labour Voters")

P.Conservative_Distance_LR <-
  ggplot(na.omit(filter(Positions, Issue %in% c("LR") & Individual == "Respondent" & Party =="Conservative")), aes(x = as.factor(value))) +
  geom_bar(aes(y = (..count..)/sum(..count..)))+
  geom_vline(data=Mean_Candidates_Lab_LR, aes(xintercept = estimate, col=Party ), size = 1.5, linetype = "dashed", alpha = 0.5) +
  scale_y_continuous(labels=percent) +
  theme_bw() +
  theme(strip.text = element_text(size=15))+
  coord_cartesian(ylim=c(0,0.28), xlim=c(0,10))+
  scale_color_manual(values= c("#0087DC", "#E4003B"), label = c("Conservative candidate average","Labour candidate average"))+
  labs(x="",y="")+
  ggtitle("Conservative Voters")

Mean_LR_Respondent_Lab <- Positions %>%
  filter(Issue =="LR" & Individual == "Respondent" & Party == "Labour") %>%
  mutate(Lower4 = value < 4) %>%
  dplyr::summarise(Percentage = weighted.mean(x = Lower4, w = W8, na.rm=T))   

##Brexit

Mean_Candidates_Profile_Brexit <- Mean_Positions %>%
  filter(Individual == "Profile" & Issue %in% c("Brexit")) %>% 
  dplyr::select(Issue, Party, estimate)
  
Mean_Respondent_Brexit <- Mean_Positions %>%
  filter(Individual == "Respondent" & Issue %in% c("Brexit")) %>% 
  dplyr::select(Issue, Party, estimate)


```

Overall, the left-right self- and candidate-reports discriminate better than any of the other positions for both Labour and Candidate supporters.  Figure \@ref(fig:LabDistance-LR) shows the distribution of Labour and Conservative voters on the left-right spectrum, together with the average position of Labour and Conservative candidates. Overall, voters of each party are concentrated around the average position of their respective candidates. This explains why `r round(CloserCandidateLabN["LR","Labour candidate"],3)*100`% of Labour voters were nearer to Labour candidates, while `r round(CloserCandidateConN["LR","Conservative candidate"],3)*100`% of Conservative voters were nearer to Conservative candidates on this issue. 

Some policies, such as redistribution in the case of Conservative voters and immigration in the case of Labour voters, might push many respondents towards candidates from the opposing party to their 2019 vote. However, there is clearly a substantial degree of alignment between party and policy issues, especially for left-right positions.  Overall, these patterns suggest that the reason party labels have modest effect is due to respondents in the no-label condition getting to the vote they would have had in the labels condition, either by correctly guessing the party based on the provided information or because they primarily care about positions in which they are aligned with the party for which they voted in the past.  

```{r LabDistance-LR, fig.width=12,fig.height=8,out.width="\\linewidth", echo=FALSE, fig.cap="Distribution of Conservative (above) and Labour (below) voters for left-right position, with candidate averages overlaid." ,fig.show='hold',fig.align='center', fig.pos="H"}
grid.arrange(P.Conservative_Distance_LR, P.Labour_Distance_LR)
```

## Candidate attribute effects

```{r AB-Analisis, include=FALSE}
## AB analysis
VoteLabel_heterAB <- Data_Exp1AB %>%
    filter(past_vote_2019_Respondent %in% c("Conservative","Labour")) 
VoteLabel_heterAB <-VoteLabel_heterAB %>%
  mutate(
                                    LRD_profDif=scale(LRD_profDif),
                                CutsSpending_profDif=scale(CutsSpending_profDif),
                                Environment_profDif=scale(Environment_profDif),
                                Redistribution_profDif=scale(Redistribution_profDif),
                                Immigration_profDif=scale(Immigration_profDif)
  )
VoteLabel_heteroAB <-VoteLabel_heterAB %>%
  mutate(qsplit = fct_recode(as.factor(qsplit), "Party Label"="1" , "No Party Label"="2")
         )%>%
  group_by(past_vote_2019_Respondent,qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(Candidate_ChosenN ~
                                  Sex_profDif
                                + Brexit_profDif
                                + LRD_profDif
                                + BornConst_profDif
                                + Age_profDif
                                + CutsSpending_profDif
                                + Environment_profDif
                                + Redistribution_profDif
                                + Immigration_profDif
                                + ExperienceCouncil_profDif
                                + Party_profDif,data =., w =pull(., W8)))
                   ,
                   results = map(fit, broom::tidy)) %>%
  unnest(results) %>%
  select(-fit)

VoteLabel_heteroAB <- VoteLabel_heteroAB %>%
  mutate(
    term = fct_recode(as.factor(term),
                      "Conservative Affiliation Candidate" = "Party_profDif",
                      "Sex Candidate"="Sex_profDif","Age Candidate"="Age_profDif" ,"Born in Constituency Candidate"="BornConst_profDif","Brexit Candidate"="Brexit_profDif" ,
                      "Experience in Council Candidate"= "ExperienceCouncil_profDif","Left-Right Candidate"="LRD_profDif","Spending Cuts Candidate" = "CutsSpending_profDif","Environment Candidate"="Environment_profDif",
                      "Immigration Candidate"="Immigration_profDif","Redistribution Candidate"="Redistribution_profDif"
    )
  )

P.Closenes_HeteroByPartyAB <- VoteLabel_heteroAB %>%
  mutate(
  past_vote_2019_Respondent = fct_recode(as.factor(past_vote_2019_Respondent), "Conservative\nVoters" = "Conservative", "Labour\nVoters" = "Labour")
  )%>%
  filter(!term == "(Intercept)" ) %>%
  mutate(
    term = fct_relevel(term,
                       "Sex Candidate","Age Candidate","Brexit Candidate","Born in Constituency Candidate",
                       "Experience in Council Candidate","Left-Right Candidate","Spending Cuts Candidate","Environment Candidate",
                       "Immigration Candidate","Redistribution Candidate")
  )%>%
  ggplot(aes(x = estimate, y = term, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5) +
    geom_vline(xintercept=0, linetype="dashed", 
             size=0.5, color="blue", alpha=0.5)+
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  coord_cartesian(xlim =c(-1,1.5))+
    theme_classic()+
    facet_grid(past_vote_2019_Respondent~., scales = "free_y")+
    theme(legend.position="bottom", strip.text.y =element_text(angle = 0),
        panel.grid.major.y = element_line(colour = "grey95"),
        panel.background = element_rect(colour = "black"))


#No party affiliation
VoteLabel_heteroAB0 <-VoteLabel_heterAB %>%
  mutate(qsplit = fct_recode(as.factor(qsplit), "Party Label"="1" , "No Party Label"="2")
         )%>%
  group_by(past_vote_2019_Respondent,qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(Candidate_ChosenN ~
                                  Sex_profDif
                                + Brexit_profDif
                                + LRD_profDif
                                + BornConst_profDif
                                + Age_profDif
                                + CutsSpending_profDif
                                + Environment_profDif
                                + Redistribution_profDif
                                + Immigration_profDif
                                + ExperienceCouncil_profDif
                                ,data =., w =pull(., W8)))
                   ,
                   results = map(fit, broom::tidy)) %>%
  unnest(results) %>%
  select(-fit)

VoteLabel_heteroAB0 <- VoteLabel_heteroAB0 %>%
  mutate(
    term = fct_recode(as.factor(term),
                      "Sex Candidate"="Sex_profDif","Age Candidate"="Age_profDif" ,"Born in Constituency Candidate"="BornConst_profDif","Brexit Candidate"="Brexit_profDif" ,
                      "Experience in Council Candidate"= "ExperienceCouncil_profDif","Left-Right Candidate"="LRD_profDif","Spending Cuts Candidate" = "CutsSpending_profDif","Environment Candidate"="Environment_profDif",
                      "Immigration Candidate"="Immigration_profDif","Redistribution Candidate"="Redistribution_profDif"
    )
  )

P.Closenes_HeteroByPartyAB0 <- VoteLabel_heteroAB0 %>%
  ungroup()%>%
  mutate(
  past_vote_2019_Respondent = fct_recode(as.factor(past_vote_2019_Respondent), "Conservative\nVoters" = "Conservative", "Labour\nVoters" = "Labour")
  )%>%
  filter(!term == "(Intercept)" ) %>%
  mutate(
    term = fct_relevel(term,
                       "Sex Candidate","Age Candidate","Brexit Candidate","Born in Constituency Candidate",
                       "Experience in Council Candidate","Left-Right Candidate","Spending Cuts Candidate","Environment Candidate",
                       "Immigration Candidate","Redistribution Candidate")
  )%>%
  ggplot(aes(x = estimate, y = term, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5) +
    geom_vline(xintercept=0, linetype="dashed", 
             size=0.5, color="blue", alpha=0.5)+
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  coord_cartesian(xlim =c(-1,1.5))+
    theme_classic()+
    facet_grid(past_vote_2019_Respondent~., scales = "free_y")+
    theme(legend.position="bottom", strip.text.y =element_text(angle = 0),
        panel.grid.major.y = element_line(colour = "grey95"),
        panel.background = element_rect(colour = "black"))
```

```{r additivity, include=FALSE}

#mutate variables to include scales
#keep only those variables, fit, and qsplit
#predict probability of conservative for label and no label conditions for each observation with model



# compare the two

VoteLabel_predict <- Data_Exp1 %>%
    filter(past_vote_2019_Respondent %in% c("Conservative","Labour")) 
VoteLabel_predict <-VoteLabel_predict %>%
  mutate(
                                    LRD_Closeness=scale(LRD_Closeness),
                                CutsSpending_Closeness=scale(CutsSpending_Closeness),
                                Environment_Closeness=scale(Environment_Closeness),
                                Redistribution_Closeness=scale(Redistribution_Closeness),
                                Immigration_Closeness=scale(Immigration_Closeness)
  )
VoteLabel_predict <-VoteLabel_predict %>%
  mutate(qsplit = dplyr::recode(as.factor(qsplit), "1" = "Party Label", "2" = "No Party Label"),
         past_vote_2019 = fct_relevel(past_vote_2019_Respondent,"Labour","Conservative")) %>%
  group_by(qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(chosen_CandidateN ~
                                  Sex_Closeness
                                + Brexit_Closeness
                                + LRD_Closeness
                                + BornConst_Closeness
                                + Age_Closeness
                                + CutsSpending_Closeness
                                + Environment_Closeness
                                + Redistribution_Closeness
                                + Immigration_Closeness
                                + ExperienceCouncil_Closeness, data =., w =pull(., W8)))
                   ,
                   data = map(data, ~select(., chosen_CandidateN,Sex_Closeness,Brexit_Closeness,LRD_Closeness,BornConst_Closeness,Age_Closeness,CutsSpending_Closeness,Environment_Closeness,Redistribution_Closeness,Immigration_Closeness,ExperienceCouncil_Closeness))
                   )
#%>%
#  unnest(data)
VoteYesLabel_predict <- modelr::add_predictions(data =VoteLabel_predict$data[[1]], model=VoteLabel_predict$fit[[1]],var = "Prediction")
VoteYesLabel_predict <- VoteYesLabel_predict %>%
  mutate(
    Error = abs(chosen_CandidateN - Prediction)
  )
VoteNoLabel_predict <- modelr::add_predictions(data =VoteLabel_predict$data[[2]], model=VoteLabel_predict$fit[[2]],var = "Prediction")
VoteNoLabel_predict <- VoteNoLabel_predict %>%
  mutate(
    Error = abs(chosen_CandidateN - Prediction)
  )
ggplot(VoteNoLabel_predict, aes(x=Prediction, y=chosen_CandidateN))+
  geom_smooth()+
  geom_point()

ggplot(VoteNoLabel_predict, aes(x=Prediction, y=Error))+
  geom_smooth()+
  geom_point()

ggplot(VoteYesLabel_predict, aes(x=Prediction, y=chosen_CandidateN))+
  geom_smooth()+
  geom_point()

ggplot(VoteYesLabel_predict, aes(x=Prediction, y=Error))+
  geom_smooth()+
  geom_point()


#Measure fit with interaction

VoteCorrectByLabel_interaction <- Data_Exp1 %>%
  filter(past_vote_2017_Respondent %in% c("Conservative","Labour")) %>%
  mutate(qsplit = fct_recode(as.factor(qsplit), "Party Label"="1", "No Party Label"="2")) %>%
  group_by(qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(chosen_CandidateN ~
                                         (Sex_Closeness
                                       + Brexit_Closeness
                                       + scale(LRD_Closeness)
                                       + BornConst_Closeness
                                       + Age_Closeness
                                       + scale(CutsSpending_Closeness)
                                       + scale(Environment_Closeness)
                                       + scale(Redistribution_Closeness)
                                       + scale(Immigration_Closeness)
                                       + ExperienceCouncil_Closeness)^2 
                                       + Past_vote_2019_Lab_or_Con, data =., w =pull(., W8))),
                   results = map(fit, broom::tidy)) %>%
  unnest(results)%>%
  select(-fit)

VoteCorrectByLabel_interaction <- VoteCorrectByLabel_interaction %>%
  mutate(
    term = fct_recode(as.factor(term),
                      "Sex"="Sex_Closeness","Age"="Age_Closeness" ,"Born in Constituency"="BornConst_Closeness","Brexit"="Brexit_Closeness" ,
                      "Experience in Council"= "ExperienceCouncil_Closeness","Left-Right"="scale(LRD_Closeness)","Spending Cuts" = "scale(CutsSpending_Closeness)","Environment"="scale(Environment_Closeness)",
                      "Immigration"="scale(Immigration_Closeness)","Redistribution"="scale(Redistribution_Closeness)"
    ),
    term = str_remove_all(as.character(term), "_Closeness"),
    term = str_remove_all(term, "scale"),
    term = str_remove_all(term, "[)]"),
        term = str_remove_all(term, "[()]"),
    term = str_replace_all(term, "LRD","Left-Right")
  )

P.Closeness_Pastvote2019_interaction <- VoteCorrectByLabel_interaction %>%
  filter(!term == "(Intercept)" ) %>%
  mutate(
    term = fct_recode(as.factor(term),"Past Party Vote 2019" ="Past_vote_2019_Lab_or_Con"),
    term = fct_relevel(term, "Past Party Vote 2019",
                       "Sex","Age","Brexit","Born in Constituency",
                       "Experience in Council","Left-Right","Spending Cuts","Environment",
                       "Immigration","Redistribution")
  )%>%
  ggplot( aes(x = estimate, y = term, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5)+
  geom_vline(xintercept=0, linetype="dashed", 
             size=0.5, color="blue", alpha=0.5)+
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  coord_cartesian(xlim = c(-0.2,1.3))+
  theme_clean()


#Measure with quadratic relation (only quadratic council experience is significant)

VoteCorrectByLabel_quadratic <- Data_Exp1 %>%
  filter(past_vote_2017_Respondent %in% c("Conservative","Labour")) %>%
  mutate(qsplit = fct_recode(as.factor(qsplit), "Party Label"="1", "No Party Label"="2")) %>%
  group_by(qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(chosen_CandidateN ~
                                         Sex_Closeness + I(Sex_Closeness^2)
                                       + Brexit_Closeness+I(Brexit_Closeness^2)
                                       + scale(LRD_Closeness)+I(scale(LRD_Closeness)^2)
                                       + BornConst_Closeness+I(BornConst_Closeness^2)
                                       + Age_Closeness+I(Age_Closeness^2)
                                       + scale(CutsSpending_Closeness)+I(scale(CutsSpending_Closeness)^2)
                                       + scale(Environment_Closeness)+I(scale(Environment_Closeness)^2)
                                       + scale(Redistribution_Closeness)+I(scale(Redistribution_Closeness)^2)
                                       + scale(Immigration_Closeness)+I(scale(Immigration_Closeness)^2)
                                       + ExperienceCouncil_Closeness+I(ExperienceCouncil_Closeness^2) 
                                       + Past_vote_2019_Lab_or_Con, data =., w =pull(., W8))),
                   results = map(fit, broom::tidy)) %>%
  unnest(results)%>%
  select(-fit)

VoteCorrectByLabel_quadratic <- VoteCorrectByLabel_quadratic %>%
  mutate(
    term = fct_recode(as.factor(term),
                      "Sex"="Sex_Closeness","Age"="Age_Closeness" ,"Born in Constituency"="BornConst_Closeness","Brexit"="Brexit_Closeness" ,
                      "Experience in Council"= "ExperienceCouncil_Closeness","Left-Right"="scale(LRD_Closeness)","Spending Cuts" = "scale(CutsSpending_Closeness)","Environment"="scale(Environment_Closeness)",
                      "Immigration"="scale(Immigration_Closeness)","Redistribution"="scale(Redistribution_Closeness)"
    ),
    term = str_remove_all(as.character(term), "_Closeness"),
    term = str_remove_all(term, "scale"),
    term = str_remove_all(term, "[)]"),
        term = str_remove_all(term, "[()]"),
    term = str_replace_all(term, "LRD","Left-Right")
  )

P.Closeness_Pastvote2019_quadratic <- VoteCorrectByLabel_quadratic %>%
  filter(!term == "(Intercept)" ) %>%
  mutate(
    term = fct_recode(as.factor(term),"Past Party Vote 2019" ="Past_vote_2019_Lab_or_Con"),
    term = fct_relevel(term, "Past Party Vote 2019",
                       "Sex","Age","Brexit","Born in Constituency",
                       "Experience in Council","Left-Right","Spending Cuts","Environment",
                       "Immigration","Redistribution")
  )%>%
  ggplot( aes(x = estimate, y = term, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5)+
  geom_vline(xintercept=0, linetype="dashed", 
             size=0.5, color="blue", alpha=0.5)+
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  coord_cartesian(xlim = c(-0.2,1.3))+
  theme_clean()

```

```{r RobustnessAB, include=FALSE}
#Measure fit with interaction

VoteCorrectByLabel_interactionAB <- Data_Exp1AB %>%
  filter(past_vote_2019_Respondent %in% c("Conservative","Labour")) %>%
  mutate(qsplit = fct_recode(as.factor(qsplit), "Party Label"="1", "No Party Label"="2")) %>%
  group_by(qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(Candidate_ChosenN ~
                                         (Sex_Closeness
                                       + Brexit_Closeness
                                       + scale(LRD_Closeness)
                                       + BornConst_Closeness
                                       + Age_Closeness
                                       + scale(CutsSpending_Closeness)
                                       + scale(Environment_Closeness)
                                       + scale(Redistribution_Closeness)
                                       + scale(Immigration_Closeness)
                                       + ExperienceCouncil_Closeness)^2 
                                       + Party_Closeness, data =., w =pull(., W8))),
                   results = map(fit, broom::tidy)) %>%
  unnest(results)%>%
  select(-fit)

VoteCorrectByLabel_interactionAB <- VoteCorrectByLabel_interactionAB %>%
  mutate(
    term = fct_recode(as.factor(term),
                      "Sex"="Sex_Closeness","Age"="Age_Closeness" ,"Born in Constituency"="BornConst_Closeness","Brexit"="Brexit_Closeness" ,
                      "Experience in Council"= "ExperienceCouncil_Closeness","Left-Right"="scale(LRD_Closeness)","Spending Cuts" = "scale(CutsSpending_Closeness)","Environment"="scale(Environment_Closeness)",
                      "Immigration"="scale(Immigration_Closeness)","Redistribution"="scale(Redistribution_Closeness)"
    ),
    term = str_remove_all(as.character(term), "_Closeness"),
    term = str_remove_all(term, "scale"),
    term = str_remove_all(term, "[)]"),
        term = str_remove_all(term, "[()]"),
    term = str_replace_all(term, "LRD","Left-Right")
  )

P.Closeness_Pastvote2019_interactionAB <- VoteCorrectByLabel_interactionAB %>%
  filter(!term == "(Intercept)" ) %>%
  mutate(
    term = fct_recode(as.factor(term),"Matching Party Vote 2019" ="Party_Closeness"),
    term = fct_relevel(term, "Matching Party Vote 2019",
                       "Sex","Age","Brexit","Born in Constituency",
                       "Experience in Council","Left-Right","Spending Cuts","Environment",
                       "Immigration","Redistribution")
  )%>%
  ggplot( aes(x = estimate, y = term, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5)+
  geom_vline(xintercept=0, linetype="dashed", 
             size=0.5, color="blue", alpha=0.5)+
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  coord_cartesian(xlim = c(-0.2,1.3))+
  theme_clean()


#Measure with quadratic relation (only quadratic council experience is significant)

VoteCorrectByLabel_quadraticAB <- Data_Exp1AB %>%
  filter(past_vote_2019_Respondent %in% c("Conservative","Labour")) %>%
  mutate(qsplit = fct_recode(as.factor(qsplit), "Party Label"="1", "No Party Label"="2")) %>%
  group_by(qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(Candidate_ChosenN ~
                                         Sex_Closeness + I(Sex_Closeness^2)
                                       + Brexit_Closeness+I(Brexit_Closeness^2)
                                       + scale(LRD_Closeness)+I(scale(LRD_Closeness)^2)
                                       + BornConst_Closeness+I(BornConst_Closeness^2)
                                       + Age_Closeness+I(Age_Closeness^2)
                                       + scale(CutsSpending_Closeness)+I(scale(CutsSpending_Closeness)^2)
                                       + scale(Environment_Closeness)+I(scale(Environment_Closeness)^2)
                                       + scale(Redistribution_Closeness)+I(scale(Redistribution_Closeness)^2)
                                       + scale(Immigration_Closeness)+I(scale(Immigration_Closeness)^2)
                                       + ExperienceCouncil_Closeness+I(ExperienceCouncil_Closeness^2) 
                                       + Party_Closeness, data =., w =pull(., W8))),
                   results = map(fit, broom::tidy)) %>%
  unnest(results)%>%
  select(-fit)

VoteCorrectByLabel_quadraticAB <- VoteCorrectByLabel_quadraticAB %>%
  mutate(
    term = fct_recode(as.factor(term),
                      "Sex"="Sex_Closeness","Age"="Age_Closeness" ,"Born in Constituency"="BornConst_Closeness","Brexit"="Brexit_Closeness" ,
                      "Experience in Council"= "ExperienceCouncil_Closeness","Left-Right"="scale(LRD_Closeness)","Spending Cuts" = "scale(CutsSpending_Closeness)","Environment"="scale(Environment_Closeness)",
                      "Immigration"="scale(Immigration_Closeness)","Redistribution"="scale(Redistribution_Closeness)"
    ),
    term = str_remove_all(as.character(term), "_Closeness"),
    term = str_remove_all(term, "scale"),
    term = str_remove_all(term, "[)]"),
        term = str_remove_all(term, "[()]"),
    term = str_replace_all(term, "LRD","Left-Right")
  )

P.Closeness_Pastvote2019_quadraticAB <- VoteCorrectByLabel_quadraticAB %>%
  filter(!term == "(Intercept)" ) %>%
  mutate(
    term = fct_recode(as.factor(term),"Past Party Vote 2019" ="Past_vote_2019_Lab_or_Con"),
    term = fct_relevel(term, "Past Party Vote 2019",
                       "Sex","Age","Brexit","Born in Constituency",
                       "Experience in Council","Left-Right","Spending Cuts","Environment",
                       "Immigration","Redistribution")
  )%>%
  ggplot( aes(x = estimate, y = term, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5)+
  geom_vline(xintercept=0, linetype="dashed", 
             size=0.5, color="blue", alpha=0.5)+
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  coord_cartesian(xlim = c(-0.2,1.3))+
  theme_clean()
```

  
```{r closenessAB, include=FALSE}

VoteCorrectByLabel2019AB <- Data_Exp1AB %>%
    filter(past_vote_2019_Respondent %in% c("Conservative","Labour")) %>%
    mutate(qsplit = fct_recode(as.factor(qsplit), "Party Label"="1", "No Party Label"="2"),
           past_vote_2019 = as.numeric(fct_relevel(past_vote_2019_Respondent,"Labour","Conservative"))) %>%
    group_by(qsplit)%>%
    nest() %>%
    dplyr::summarise(fit = map(data, ~lm(Candidate_ChosenN ~
                                            Sex_Closeness
                                          + Brexit_Closeness
                                          + scale(LRD_Closeness)
                                          + BornConst_Closeness
                                          + Age_Closeness
                                          + scale(CutsSpending_Closeness)
                                          + scale(Environment_Closeness)
                                          + scale(Redistribution_Closeness)
                                          + scale(Immigration_Closeness)
                                          + ExperienceCouncil_Closeness 
                                          + Party_Closeness, data =., w =pull(., W8))),
                     results = map(fit, broom::tidy)) %>%
    unnest(results)%>%
    select(-fit)
  
  VoteCorrectByLabel2019AB <- VoteCorrectByLabel2019AB %>%
    mutate(
      term = fct_recode(as.factor(term),
                        "Sex"="Sex_Closeness","Age"="Age_Closeness" ,"Born in Constituency"="BornConst_Closeness","Brexit"="Brexit_Closeness" ,
                        "Experience in Council"= "ExperienceCouncil_Closeness","Left-Right"="scale(LRD_Closeness)","Spending Cuts" = "scale(CutsSpending_Closeness)","Environment"="scale(Environment_Closeness)",
                        "Immigration"="scale(Immigration_Closeness)","Redistribution"="scale(Redistribution_Closeness)"
      )
    )
  
  P.ClosenessAB <- VoteCorrectByLabel2019AB %>%
    filter(!term == "(Intercept)" ) %>%
    mutate(
      term = fct_recode(as.factor(term),"Matching Party Vote 2019" ="Party_Closeness"),
      term = fct_relevel(term, "Matching Party Vote 2019",
                         "Sex","Age","Brexit","Born in Constituency",
                         "Experience in Council","Left-Right","Spending Cuts","Environment",
                         "Immigration","Redistribution")
    )%>%
    ggplot( aes(x = estimate, y = term, col = qsplit))+
    geom_point(position = position_dodge(width =0.3))+
    geom_errorbar(position = position_dodge(width =0.3),
                  aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5)+
    geom_vline(xintercept=0, linetype="dashed", 
               size=0.5, color="blue", alpha=0.5)+
    scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
    labs(x="",y="")+
    coord_cartesian(xlim = c(-0.2,1.3))+
    ggtitle("Closeness of candidates’ positions to respondents’ positions\nas predictors of candidate choice")+
    theme_clean()
  
  #Interacting with past vote

 VoteCorrectByLabel2019_ByPastVoteAB <- Data_Exp1AB %>%
    filter(past_vote_2019_Respondent %in% c("Conservative","Labour")) %>%
    mutate(qsplit = fct_recode(as.factor(qsplit), "Party Label"="1", "No Party Label"="2"),
           past_vote_2019 = as.numeric(fct_relevel(past_vote_2019_Respondent,"Labour","Conservative"))) %>%
    group_by(qsplit)%>%
    nest() %>%
    dplyr::summarise(fit = map(data, ~lm(Candidate_ChosenN ~
                                            Sex_Closeness*past_vote_2019_Respondent
                                          + Brexit_Closeness*past_vote_2019_Respondent
                                          + scale(LRD_Closeness)*past_vote_2019_Respondent
                                          + BornConst_Closeness*past_vote_2019_Respondent
                                          + Age_Closeness*past_vote_2019_Respondent
                                          + scale(CutsSpending_Closeness)*past_vote_2019_Respondent
                                          + scale(Environment_Closeness)*past_vote_2019_Respondent
                                          + scale(Redistribution_Closeness)*past_vote_2019_Respondent
                                          + scale(Immigration_Closeness)*past_vote_2019_Respondent
                                          + ExperienceCouncil_Closeness *past_vote_2019_Respondent
                                          + Party_Closeness*past_vote_2019_Respondent, data =., w =pull(., W8))),
                     results = map(fit, broom::tidy)) %>%
    unnest(results)%>%
    select(-fit)
  
  VoteCorrectByLabel2019_ByPastVoteAB <- VoteCorrectByLabel2019_ByPastVoteAB %>%
    mutate(
      term = fct_recode(as.factor(term),
                        "Sex"="Sex_Closeness","Age"="Age_Closeness" ,"Born in Constituency"="BornConst_Closeness","Brexit"="Brexit_Closeness" ,
                        "Experience in Council"= "ExperienceCouncil_Closeness","Left-Right"="scale(LRD_Closeness)","Spending Cuts" = "scale(CutsSpending_Closeness)","Environment"="scale(Environment_Closeness)",
                        "Immigration"="scale(Immigration_Closeness)","Redistribution"="scale(Redistribution_Closeness)"
      )
    )
  
  P.Closeness_Pastvote2019_ByPArtyAB <- VoteCorrectByLabel2019_ByPastVoteAB %>%
    filter(!term == "(Intercept)" ) %>%
    mutate(
      term = fct_recode(as.factor(term),"Matching Party Vote 2019" ="Party_Closeness"),
      term = fct_relevel(term, "Matching Party Vote 2019",
                         "Sex","Age","Brexit","Born in Constituency",
                         "Experience in Council","Left-Right","Spending Cuts","Environment",
                         "Immigration","Redistribution")
    )%>%
    ggplot( aes(x = estimate, y = term, col = qsplit))+
    geom_point(position = position_dodge(width =0.3))+
    geom_errorbar(position = position_dodge(width =0.3),
                  aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5)+
    geom_vline(xintercept=0, linetype="dashed", 
               size=0.5, color="blue", alpha=0.5)+
    scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
    labs(x="",y="")+
    coord_cartesian(xlim = c(-0.2,1.3))+
    ggtitle("Closeness of candidates’ positions to respondents’ positions\nas predictors of candidate choice\nInteracted with past vote")+
    theme_clean()
  
## Divided by past vote 
  
VoteCorrectByLabel2019AB_SepPast <- Data_Exp1AB %>%
    filter(past_vote_2019_Respondent %in% c("Conservative","Labour")) %>%
    mutate(qsplit = fct_recode(as.factor(qsplit), "Party Label"="1", "No Party Label"="2"),
           past_vote_2019 = as.numeric(fct_relevel(past_vote_2019_Respondent,"Labour","Conservative"))) %>%
     group_by(past_vote_2019_Respondent, qsplit)%>%
    nest() %>%
    dplyr::summarise(fit = map(data, ~lm(Candidate_ChosenN ~
                                            Sex_Closeness
                                          + Brexit_Closeness
                                          + scale(LRD_Closeness)
                                          + BornConst_Closeness
                                          + Age_Closeness
                                          + scale(CutsSpending_Closeness)
                                          + scale(Environment_Closeness)
                                          + scale(Redistribution_Closeness)
                                          + scale(Immigration_Closeness)
                                          + ExperienceCouncil_Closeness 
                                          + Party_Closeness, data =., w =pull(., W8))),
                     results = map(fit, broom::tidy)) %>%
    unnest(results)%>%
    select(-fit)
  
  VoteCorrectByLabel2019AB_SepPast <- VoteCorrectByLabel2019AB_SepPast %>%
    mutate(
      term = fct_recode(as.factor(term),
                        "Sex"="Sex_Closeness","Age"="Age_Closeness" ,"Born in Constituency"="BornConst_Closeness","Brexit"="Brexit_Closeness" ,
                        "Experience in Council"= "ExperienceCouncil_Closeness","Left-Right"="scale(LRD_Closeness)","Spending Cuts" = "scale(CutsSpending_Closeness)","Environment"="scale(Environment_Closeness)",
                        "Immigration"="scale(Immigration_Closeness)","Redistribution"="scale(Redistribution_Closeness)"
      )
    )
  
  P.ClosenessAB_SepPast <- VoteCorrectByLabel2019AB_SepPast %>%
      mutate(
  past_vote_2019_Respondent = fct_recode(as.factor(past_vote_2019_Respondent), "Conservative\nVoters" = "Conservative", "Labour\nVoters" = "Labour")
  )%>%
    filter(!term == "(Intercept)" ) %>%
    mutate(
      term = fct_recode(as.factor(term),"Matching Party Vote 2019" ="Party_Closeness"),
      term = fct_relevel(term, "Matching Party Vote 2019",
                         "Sex","Age","Brexit","Born in Constituency",
                         "Experience in Council","Left-Right","Spending Cuts","Environment",
                         "Immigration","Redistribution")
    )%>%
    ggplot( aes(x = estimate, y = term, col = qsplit))+
    geom_point(position = position_dodge(width =0.3))+
    geom_errorbar(position = position_dodge(width =0.3),
                  aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5)+
    geom_vline(xintercept=0, linetype="dashed", 
               size=0.5, color="blue", alpha=0.5)+
    scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
    labs(x="",y="")+
    coord_cartesian(xlim = c(-0.2,1.3))+
    ggtitle("Closeness of candidates’ positions to respondents’ positions\nas predictors of candidate choice")+
    theme_classic()+
    facet_grid(past_vote_2019_Respondent~., scales = "free_y")+
    theme(legend.position="bottom", strip.text.y =element_text(angle = 0),
        panel.grid.major.y = element_line(colour = "grey95"),
        panel.background = element_rect(colour = "black"))

```

```{r heteropholy, include=FALSE}

Data_Exp1<- Data_Exp1 %>%
dplyr::mutate(
    Sex_profDif= Sex_Con_Profile-Sex_Lab_Profile,
    Brexit_profDif = Brexit_Con_Profile-Brexit_Lab_Profile,
    LRD_profDif =  LR_Con_Profile-LR_Lab_Profile,
    BornConst_profDif= BornConst_Con_Profile - BornConst_Lab_Profile,
    Age_profDif =  Age_Con_Profile-Age_Lab_Profile,
    CutsSpending_profDif = CutsSpending_Con_Profile-CutsSpending_Lab_Profile,
    Environment_profDif = Environment_Con_Profile-Environment_Lab_Profile,
    Redistribution_profDif = Redistribution_Con_Profile-Redistribution_Lab_Profile,
    Immigration_profDif = ImmigrationEcon_Con_Profile-ImmigrationEcon_Lab_Profile,
    ExperienceCouncil_profDif = ExperienceCouncil_Con_Profile - ExperienceCouncil_Lab_Profile
  )

VoteLabel_heter <- Data_Exp1 %>%
    filter(past_vote_2019_Respondent %in% c("Conservative","Labour")) 
VoteLabel_heter <-VoteLabel_heter %>%
  mutate(
                                    LRD_profDif=scale(LRD_profDif),
                                CutsSpending_profDif=scale(CutsSpending_profDif),
                                Environment_profDif=scale(Environment_profDif),
                                Redistribution_profDif=scale(Redistribution_profDif),
                                Immigration_profDif=scale(Immigration_profDif)
  )
VoteLabel_hetero <-VoteLabel_heter %>%
  mutate(qsplit = fct_recode(as.factor(qsplit), "Party Label"="1" , "No Party Label"="2")
         )%>%
  group_by(qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(chosen_CandidateN ~
                                  Sex_profDif
                                + Brexit_profDif
                                + LRD_profDif
                                + BornConst_profDif
                                + Age_profDif
                                + CutsSpending_profDif
                                + Environment_profDif
                                + Redistribution_profDif
                                + Immigration_profDif
                                + ExperienceCouncil_profDif
                                + Past_vote_2019_Lab_or_Con ,data =., w =pull(., W8)))
                   ,
                   results = map(fit, broom::tidy)) %>%
  unnest(results) 

VoteLabel_hetero <- VoteLabel_hetero %>%
  mutate(
    term = fct_recode(as.factor(term),
                      "Sex Candidate"="Sex_profDif","Age Candidate"="Age_profDif" ,"Born in Constituency Candidate"="BornConst_profDif","Brexit Candidate"="Brexit_profDif" ,
                      "Experience in Council Candidate"= "ExperienceCouncil_profDif","Left-Right Candidate"="LRD_profDif","Spending Cuts Candidate" = "CutsSpending_profDif","Environment Candidate"="Environment_profDif",
                      "Immigration Candidate"="Immigration_profDif","Redistribution Candidate"="Redistribution_profDif"
    )
  )

VoteLabel_heterbyparty <-VoteLabel_heter %>%
  mutate(qsplit = fct_recode(as.factor(qsplit), "Party Label"="1" , "No Party Label"="2")
         )%>%
  group_by(past_vote_2019_Respondent,qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(chosen_CandidateN ~
                                  Sex_profDif
                                + Brexit_profDif
                                + LRD_profDif
                                + BornConst_profDif
                                + Age_profDif
                                + CutsSpending_profDif
                                + Environment_profDif
                                + Redistribution_profDif
                                + Immigration_profDif
                                + ExperienceCouncil_profDif,data =., w =pull(., W8)))
                   ,
                   results = map(fit, broom::tidy)) %>%
  unnest(results) 

VoteLabel_heterbyparty <- VoteLabel_heterbyparty %>%
  mutate(
    term = fct_recode(as.factor(term),
                      "Sex Candidate"="Sex_profDif","Age Candidate"="Age_profDif" ,"Born in Constituency Candidate"="BornConst_profDif","Brexit Candidate"="Brexit_profDif" ,
                      "Experience in Council Candidate"= "ExperienceCouncil_profDif","Left-Right Candidate"="LRD_profDif","Spending Cuts Candidate" = "CutsSpending_profDif","Environment Candidate"="Environment_profDif",
                      "Immigration Candidate"="Immigration_profDif","Redistribution Candidate"="Redistribution_profDif"
    )
  )

#Unsurprsingly, nothing is significant in the overall population
P.Hetero_pure <- VoteLabel_hetero%>%
  filter(!term == "(Intercept)" ) %>%
  mutate(
    term = fct_recode(as.factor(term),"Past Party Vote 2019" ="Past_vote_2019_Lab_or_Con"),
    term = fct_relevel(term, "Past Party Vote 2019",
                       "Sex Candidate","Age Candidate","Brexit Candidate","Born in Constituency Candidate",
                       "Experience in Council Candidate","Left-Right Candidate","Spending Cuts Candidate","Environment Candidate",
                       "Immigration Candidate","Redistribution Candidate")
  )%>%
  ggplot( aes(x = estimate, y = term, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5)+
  geom_vline(xintercept=0, linetype="dashed", 
             size=0.5, color="blue", alpha=0.5)+
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  coord_cartesian(xlim = c(-0.2,1.3))+
  ggtitle("Closeness of candidates’ positions to respondents’ positions
with and without party labels as predictors of candidate choice")+
  theme_clean()

#By party nothing relevant significant

P.Closenes_HeteroByParty <- VoteLabel_heterbyparty %>%
  filter(past_vote_2019_Respondent %in% c("Conservative", "Labour"))%>%
  filter(!term == "(Intercept)" ) %>%
  mutate(
    term = fct_relevel(term,
                       "Sex Candidate","Age Candidate","Brexit Candidate","Born in Constituency Candidate",
                       "Experience in Council Candidate","Left-Right Candidate","Spending Cuts Candidate","Environment Candidate",
                       "Immigration Candidate","Redistribution Candidate")
  )%>%
  ggplot(aes(x = estimate, y = term, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5) +
  facet_wrap(~past_vote_2019_Respondent)+
    geom_vline(xintercept=0, linetype="dashed", 
             size=0.5, color="blue", alpha=0.5)+
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  coord_cartesian(xlim =c(-0.5,0.5))+
  theme_clean()


# Add interaction effects

VoteLabel_heter_interact <-VoteLabel_heter %>%
  mutate(qsplit = fct_recode(as.factor(qsplit), "Party Label"="1" , "No Party Label"="2")
         )%>%
  group_by(qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(chosen_CandidateN ~
                                  Sex_profDif*gender_Respondent
                                + Brexit_profDif*euRefVote_Respondent
                                + LRD_profDif*leftRight_Respondent
                                + BornConst_profDif
                                + Age_profDif*age_respondent
                                + CutsSpending_profDif*cutsTooFar_Respondent
                                + Environment_profDif*enviroProtection_Respondent
                                + Redistribution_profDif*redist_Respondent
                                + Immigration_profDif*immigEcon_Respondent
                                + ExperienceCouncil_profDif
                                + Past_vote_2019_Lab_or_Con ,data =., w =pull(., W8)))
                   ,
                   results = map(fit, broom::tidy)) %>%
  unnest(results) %>%
  select(-fit)

VoteLabel_heter_interact <- VoteLabel_heter_interact %>%
  mutate(
    term = fct_recode(as.factor(term),
                      "Sex Candidate"="Sex_profDif","Age Candidate"="Age_profDif" ,"Born in Constituency Candidate"="BornConst_profDif","Brexit Candidate"="Brexit_profDif" ,
                      "Experience in Council Candidate"= "ExperienceCouncil_profDif","Left-Right Candidate"="LRD_profDif","Spending Cuts Candidate" = "CutsSpending_profDif","Environment Candidate"="Environment_profDif",
                      "Immigration Candidate"="Immigration_profDif","Redistribution Candidate"="Redistribution_profDif", "Age Interaction"="Age_profDif:age_respondent", "Brexit Interaction"= "Brexit_profDif:euRefVote_Respondent", "Spending Cuts Interaction"="CutsSpending_profDif:cutsTooFar_Respondent", "Immigration Interaction"="Immigration_profDif:immigEcon_Respondent" , "Environment Interaction"="Environment_profDif:enviroProtection_Respondent", "Left-Right Interaction"="LRD_profDif:leftRight_Respondent", "Redistribution Interaction"="Redistribution_profDif:redist_Respondent", "Sex Interaction"="Sex_profDif:gender_Respondent",
                      "Age Respondent"="age_respondent", "Brexit Respondent"= "euRefVote_Respondent", "Spending Cuts Respondent"="cutsTooFar_Respondent", "Immigration Respondent"="immigEcon_Respondent" , "Environment Respondent"="enviroProtection_Respondent", "Left-Right Respondent"="leftRight_Respondent", "Redistribution Respondent"="redist_Respondent", "Sex Respondent"="gender_Respondent" 
    )
  )


P.Heterobyparty_Interaction <- VoteLabel_heter_interact%>%
  filter(!term == "(Intercept)" ) %>%
  mutate(
    term = fct_recode(as.factor(term),"Past Party Vote 2019 Respondent" ="Past_vote_2019_Lab_or_Con"),
    term = fct_relevel(term, "Past Party Vote 2019 Respondent",
                       "Sex Respondent","Sex Candidate","Sex Interaction","Age Respondent","Age Candidate","Age Interaction","Brexit Respondent","Brexit Candidate","Brexit Interaction","Born in Constituency Candidate",
                       "Experience in Council Candidate","Left-Right Respondent","Left-Right Candidate","Left-Right Interaction","Spending Cuts Respondent","Spending Cuts Candidate","Spending Cuts Interaction","Environment Respondent","Environment Candidate","Environment Interaction", "Immigration Respondent","Immigration Candidate", "Immigration Interaction", "Redistribution Respondent","Redistribution Candidate", "Redistribution Interaction")
  )%>%
  ggplot(aes(x = estimate, y = term, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5) +
    geom_vline(xintercept=0, linetype="dashed", 
             size=0.5, color="blue", alpha=0.5)+
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  coord_cartesian(xlim =c(-0.5,0.5))+
  theme_clean()

#Controlling for 2017 vote by party

VoteLabel_heterbyparty_interact <-VoteLabel_heter %>%
  mutate(qsplit = fct_recode(as.factor(qsplit), "Party Label"="1" , "No Party Label"="2")
         )%>%
  group_by(past_vote_2019_Respondent,qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(chosen_CandidateN ~
                                  Sex_profDif*gender_Respondent
                                + Brexit_profDif*euRefVote_Respondent
                                + LRD_profDif*leftRight_Respondent
                                + BornConst_profDif
                                + Age_profDif*age_respondent
                                + CutsSpending_profDif*cutsTooFar_Respondent
                                + Environment_profDif*enviroProtection_Respondent
                                + Redistribution_profDif*redist_Respondent
                                + Immigration_profDif*immigEcon_Respondent
                                + ExperienceCouncil_profDif
                                + Past_vote_2017_Lab_or_Con ,data =., w =pull(., W8)))
                   ,
                   results = map(fit, broom::tidy)) %>%
  unnest(results) %>%
  select(-fit)

VoteLabel_heterbyparty_interact <- VoteLabel_heterbyparty_interact %>%
  mutate(
    term = fct_recode(as.factor(term),
                      "Sex Candidate"="Sex_profDif","Age Candidate"="Age_profDif" ,"Born in Constituency Candidate"="BornConst_profDif","Brexit Candidate"="Brexit_profDif" ,
                      "Experience in Council Candidate"= "ExperienceCouncil_profDif","Left-Right Candidate"="LRD_profDif","Spending Cuts Candidate" = "CutsSpending_profDif","Environment Candidate"="Environment_profDif",
                      "Immigration Candidate"="Immigration_profDif","Redistribution Candidate"="Redistribution_profDif", "Age Interaction"="Age_profDif:age_respondent", "Brexit Interaction"= "Brexit_profDif:euRefVote_Respondent", "Spending Cuts Interaction"="CutsSpending_profDif:cutsTooFar_Respondent", "Immigration Interaction"="Immigration_profDif:immigEcon_Respondent" , "Environment Interaction"="Environment_profDif:enviroProtection_Respondent", "Left-Right Interaction"="LRD_profDif:leftRight_Respondent", "Redistribution Interaction"="Redistribution_profDif:redist_Respondent", "Sex Interaction"="Sex_profDif:gender_Respondent",
                      "Age Respondent"="age_respondent", "Brexit Respondent"= "euRefVote_Respondent", "Spending Cuts Respondent"="cutsTooFar_Respondent", "Immigration Respondent"="immigEcon_Respondent" , "Environment Respondent"="enviroProtection_Respondent", "Left-Right Respondent"="leftRight_Respondent", "Redistribution Respondent"="redist_Respondent", "Sex Respondent"="gender_Respondent" 
    )
  )

P.Heterobyparty_InteractionAndPastvote <- VoteLabel_heterbyparty_interact%>%
  filter(!term == "(Intercept)" ) %>%
  mutate(
    term = fct_recode(as.factor(term),"Past Party Vote 2017 Respondent" ="Past_vote_2017_Lab_or_Con"),
    term = fct_relevel(term, "Past Party Vote 2017 Respondent",
                       "Sex Respondent","Sex Candidate","Sex Interaction","Age Respondent","Age Candidate","Age Interaction","Brexit Respondent","Brexit Candidate","Brexit Interaction","Born in Constituency Candidate",
                       "Experience in Council Candidate","Left-Right Respondent","Left-Right Candidate","Left-Right Interaction","Spending Cuts Respondent","Spending Cuts Candidate","Spending Cuts Interaction","Environment Respondent","Environment Candidate","Environment Interaction", "Immigration Respondent","Immigration Candidate", "Immigration Interaction", "Redistribution Respondent","Redistribution Candidate", "Redistribution Interaction")
  )%>%
  ggplot(aes(x = estimate, y = term, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5) +
  facet_wrap(~past_vote_2019_Respondent)+
    geom_vline(xintercept=0, linetype="dashed", 
             size=0.5, color="blue", alpha=0.5)+
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  coord_cartesian(xlim =c(-0.5,0.5))+
  theme_clean()

# Not controlling for 2017 vote

VoteLabel_heterbyparty_interact <-VoteLabel_heter %>%
  mutate(qsplit = fct_recode(as.factor(qsplit), "Party Label"="1" , "No Party Label"="2")
         )%>%
  group_by(past_vote_2019_Respondent,qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(chosen_CandidateN ~
                                  Sex_profDif*gender_Respondent
                                + Brexit_profDif*euRefVote_Respondent
                                + LRD_profDif*leftRight_Respondent
                                + BornConst_profDif
                                + Age_profDif*age_respondent
                                + CutsSpending_profDif*cutsTooFar_Respondent
                                + Environment_profDif*enviroProtection_Respondent
                                + Redistribution_profDif*redist_Respondent
                                + Immigration_profDif*immigEcon_Respondent
                                + ExperienceCouncil_profDif,data =., w =pull(., W8)))
                   ,
                   results = map(fit, broom::tidy)) %>%
  unnest(results) %>%
  select(-fit)

VoteLabel_heterbyparty_interact <- VoteLabel_heterbyparty_interact %>%
  mutate(
    term = fct_recode(as.factor(term),
                      "Sex Candidate"="Sex_profDif","Age Candidate"="Age_profDif" ,"Born in Constituency Candidate"="BornConst_profDif","Brexit Candidate"="Brexit_profDif" ,
                      "Experience in Council Candidate"= "ExperienceCouncil_profDif","Left-Right Candidate"="LRD_profDif","Spending Cuts Candidate" = "CutsSpending_profDif","Environment Candidate"="Environment_profDif",
                      "Immigration Candidate"="Immigration_profDif","Redistribution Candidate"="Redistribution_profDif", "Age Interaction"="Age_profDif:age_respondent", "Brexit Interaction"= "Brexit_profDif:euRefVote_Respondent", "Spending Cuts Interaction"="CutsSpending_profDif:cutsTooFar_Respondent", "Immigration Interaction"="Immigration_profDif:immigEcon_Respondent" , "Environment Interaction"="Environment_profDif:enviroProtection_Respondent", "Left-Right Interaction"="LRD_profDif:leftRight_Respondent", "Redistribution Interaction"="Redistribution_profDif:redist_Respondent", "Sex Interaction"="Sex_profDif:gender_Respondent",
                      "Age Respondent"="age_respondent", "Brexit Respondent"= "euRefVote_Respondent", "Spending Cuts Respondent"="cutsTooFar_Respondent", "Immigration Respondent"="immigEcon_Respondent" , "Environment Respondent"="enviroProtection_Respondent", "Left-Right Respondent"="leftRight_Respondent", "Redistribution Respondent"="redist_Respondent", "Sex Respondent"="gender_Respondent" 
    )
  )

P.Hetero_InteractionAndPastvote <- VoteLabel_heterbyparty_interact%>%
  filter(!term == "(Intercept)" ) %>%
  mutate(
    term = fct_relevel(term,
                       "Sex Respondent","Sex Candidate","Sex Interaction","Age Respondent","Age Candidate","Age Interaction","Brexit Respondent","Brexit Candidate","Brexit Interaction","Born in Constituency Candidate",
                       "Experience in Council Candidate","Left-Right Respondent","Left-Right Candidate","Left-Right Interaction","Spending Cuts Respondent","Spending Cuts Candidate","Spending Cuts Interaction","Environment Respondent","Environment Candidate","Environment Interaction", "Immigration Respondent","Immigration Candidate", "Immigration Interaction", "Redistribution Respondent","Redistribution Candidate", "Redistribution Interaction")
  )%>%
  ggplot(aes(x = estimate, y = term, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5) +
  facet_wrap(~past_vote_2019_Respondent)+
    geom_vline(xintercept=0, linetype="dashed", 
             size=0.5, color="blue", alpha=0.5)+
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  coord_cartesian(xlim =c(-0.5,0.5))+
  theme_clean()

```

```{r FullclosenessModelAB, include=FALSE}


VoteLabel_heter_InteractAB <-Data_Exp1AB %>%
    filter(past_vote_2019_Respondent %in% c("Conservative","Labour")) %>%
    mutate(qsplit = fct_recode(as.factor(qsplit), "Party Label"="1" , "No Party Label"="2")
    )%>%
    group_by(qsplit)%>%
    nest() %>%
  dplyr::summarise(fit = map(data, ~lm(Candidate_ChosenN ~
                                  Sex_profDif*gender_Respondent
                                + Brexit_profDif*euRefVote_Respondent
                                + LRD_profDif*leftRight_Respondent
                                + BornConst_profDif
                                + Age_profDif*age_respondent
                                + CutsSpending_profDif*cutsTooFar_Respondent
                                + Environment_profDif*enviroProtection_Respondent
                                + Redistribution_profDif*redist_Respondent
                                + Immigration_profDif*immigEcon_Respondent
                                + ExperienceCouncil_profDif
                                + Party_profDif*past_vote_2019_Respondent ,data =., w =pull(., W8)))
                   ,
                   results = map(fit, broom::tidy)) %>%
  unnest(results) %>%
  select(-fit)

VoteLabel_heter_InteractAB <- VoteLabel_heter_InteractAB %>%
  mutate(
    term = fct_recode(as.factor(term),
                      "Sex Candidate"="Sex_profDif","Age Candidate"="Age_profDif" ,"Born in Constituency Candidate"="BornConst_profDif","Brexit Candidate"="Brexit_profDif" ,
                      "Experience in Council Candidate"= "ExperienceCouncil_profDif","Left-Right Candidate"="LRD_profDif","Spending Cuts Candidate" = "CutsSpending_profDif","Environment Candidate"="Environment_profDif",
                      "Immigration Candidate"="Immigration_profDif","Redistribution Candidate"="Redistribution_profDif", "Age Interaction"="Age_profDif:age_respondent", "Brexit Interaction"= "Brexit_profDif:euRefVote_Respondent", "Spending Cuts Interaction"="CutsSpending_profDif:cutsTooFar_Respondent", "Immigration Interaction"="Immigration_profDif:immigEcon_Respondent" , "Environment Interaction"="Environment_profDif:enviroProtection_Respondent", "Left-Right Interaction"="LRD_profDif:leftRight_Respondent", "Redistribution Interaction"="Redistribution_profDif:redist_Respondent", "Sex Interaction"="Sex_profDif:gender_Respondent",
                      "Age Respondent"="age_respondent", "Brexit Respondent"= "euRefVote_Respondent", "Spending Cuts Respondent"="cutsTooFar_Respondent", "Immigration Respondent"="immigEcon_Respondent" , "Environment Respondent"="enviroProtection_Respondent", "Left-Right Respondent"="leftRight_Respondent", "Redistribution Respondent"="redist_Respondent", "Sex Respondent"="gender_Respondent" 
    )
  )


VoteLabel_heter_InteractAB <- VoteLabel_heter_InteractAB%>%
  filter(!term == "(Intercept)" ) %>%
  mutate(
    term = fct_recode(as.factor(term),"Conservative Candidate" ="Party_profDif", "Labour Respondent"="past_vote_2019_RespondentLabour","Party Interaction" = "Party_profDif:past_vote_2019_RespondentLabour"),
    term = fct_relevel(term, "Labour Respondent","Left-Right Respondent","Brexit Respondent","Spending Cuts Respondent","Redistribution Respondent","Immigration Respondent","Environment Respondent", "Sex Respondent","Age Respondent",
                       
"Party Interaction","Left-Right Interaction","Brexit Interaction","Spending Cuts Interaction","Redistribution Interaction","Immigration Interaction","Environment Interaction", "Sex Interaction","Age Interaction",

"Conservative Candidate","Left-Right Candidate","Brexit Candidate","Spending Cuts Candidate","Redistribution Candidate","Immigration Candidate","Environment Candidate", "Sex Candidate","Age Candidate","Born in Constituency Candidate","Experience in Council Candidate")
  )%>%
  mutate(
    term = str_replace(term, " Candidate", "_Candidate"),
    term = str_replace(term, " Interaction", "_Interaction"),
    term = str_replace(term, " Respondent", "_Respondent")
  )%>%
  separate(term, into = c("term", "type"), sep="_")

P.FlexibleAB<-VoteLabel_heter_InteractAB%>%
  ggplot(aes(x = estimate, y = term, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5) +
    geom_vline(xintercept=0, linetype="dashed", 
             size=0.5, color="blue", alpha=0.5)+
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  coord_cartesian(xlim =c(-1.5,1.5))+
  facet_grid(type~., scales = "free_y")+
  theme_classic()+
  theme(legend.position="bottom", strip.text.y =element_text(angle = 0),
        panel.grid.major.y = element_line(colour = "grey95"),
        panel.background = element_rect(colour = "black"))

#Separate model for Labour and Conservative

## Conservative

VoteLabel_heter_InteractABCons <-Data_Exp1AB %>%
    filter(past_vote_2019_Respondent %in% c("Conservative")) %>%
    mutate(qsplit = fct_recode(as.factor(qsplit), "Party Label"="1" , "No Party Label"="2")
    )%>%
    group_by(qsplit)%>%
    nest() %>%
  dplyr::summarise(fit = map(data, ~lm(Candidate_ChosenN ~
                                  Sex_profDif*gender_Respondent
                                + Brexit_profDif*euRefVote_Respondent
                                + LRD_profDif*leftRight_Respondent
                                + BornConst_profDif
                                + Age_profDif*age_respondent
                                + CutsSpending_profDif*cutsTooFar_Respondent
                                + Environment_profDif*enviroProtection_Respondent
                                + Redistribution_profDif*redist_Respondent
                                + Immigration_profDif*immigEcon_Respondent
                                + ExperienceCouncil_profDif
                                + Party_profDif ,data =., w =pull(., W8)))
                   ,
                   results = map(fit, broom::tidy)) %>%
  unnest(results) %>%
  select(-fit)

VoteLabel_heter_InteractABCons <- VoteLabel_heter_InteractABCons %>%
  mutate(
    term = fct_recode(as.factor(term),
                      "Sex Candidate"="Sex_profDif","Age Candidate"="Age_profDif" ,"Born in Constituency Candidate"="BornConst_profDif","Brexit Candidate"="Brexit_profDif" ,
                      "Experience in Council Candidate"= "ExperienceCouncil_profDif","Left-Right Candidate"="LRD_profDif","Spending Cuts Candidate" = "CutsSpending_profDif","Environment Candidate"="Environment_profDif",
                      "Immigration Candidate"="Immigration_profDif","Redistribution Candidate"="Redistribution_profDif", "Age Interaction"="Age_profDif:age_respondent", "Brexit Interaction"= "Brexit_profDif:euRefVote_Respondent", "Spending Cuts Interaction"="CutsSpending_profDif:cutsTooFar_Respondent", "Immigration Interaction"="Immigration_profDif:immigEcon_Respondent" , "Environment Interaction"="Environment_profDif:enviroProtection_Respondent", "Left-Right Interaction"="LRD_profDif:leftRight_Respondent", "Redistribution Interaction"="Redistribution_profDif:redist_Respondent", "Sex Interaction"="Sex_profDif:gender_Respondent",
                      "Age Respondent"="age_respondent", "Brexit Respondent"= "euRefVote_Respondent", "Spending Cuts Respondent"="cutsTooFar_Respondent", "Immigration Respondent"="immigEcon_Respondent" , "Environment Respondent"="enviroProtection_Respondent", "Left-Right Respondent"="leftRight_Respondent", "Redistribution Respondent"="redist_Respondent", "Sex Respondent"="gender_Respondent" 
    )
  )


VoteLabel_heter_InteractABCons <- VoteLabel_heter_InteractABCons%>%
  filter(!term == "(Intercept)" ) %>%
  mutate(
    term = fct_recode(as.factor(term),"Conservative Candidate" ="Party_profDif"),
    term = fct_relevel(term, "Left-Right Respondent","Brexit Respondent","Spending Cuts Respondent","Redistribution Respondent","Immigration Respondent","Environment Respondent", "Sex Respondent","Age Respondent",
                       
"Left-Right Interaction","Brexit Interaction","Spending Cuts Interaction","Redistribution Interaction","Immigration Interaction","Environment Interaction", "Sex Interaction","Age Interaction",

"Conservative Candidate","Left-Right Candidate","Brexit Candidate","Spending Cuts Candidate","Redistribution Candidate","Immigration Candidate","Environment Candidate", "Sex Candidate","Age Candidate","Born in Constituency Candidate","Experience in Council Candidate")
  )%>%
  mutate(
    term = str_replace(term, " Candidate", "_Candidate"),
    term = str_replace(term, " Interaction", "_Interaction"),
    term = str_replace(term, " Respondent", "_Respondent")
  )%>%
  separate(term, into = c("term", "type"), sep="_")

P.FlexibleABCons<-VoteLabel_heter_InteractABCons%>%
  ggplot(aes(x = estimate, y = term, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5) +
    geom_vline(xintercept=0, linetype="dashed", 
             size=0.5, color="blue", alpha=0.5)+
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  coord_cartesian(xlim =c(-1.5,1.5))+
  facet_grid(type~., scales = "free_y")+
  theme_classic()+
  theme(legend.position="bottom", strip.text.y =element_text(angle = 0),
        panel.grid.major.y = element_line(colour = "grey95"),
        panel.background = element_rect(colour = "black"))+
  ggtitle("Conservative Voters")

## Labour
VoteLabel_heter_InteractABLab <-Data_Exp1AB %>%
    filter(past_vote_2019_Respondent %in% c("Labour")) %>%
    mutate(qsplit = fct_recode(as.factor(qsplit), "Party Label"="1" , "No Party Label"="2")
    )%>%
    group_by(qsplit)%>%
    nest() %>%
  dplyr::summarise(fit = map(data, ~lm(Candidate_ChosenN ~
                                  Sex_profDif*gender_Respondent
                                + Brexit_profDif*euRefVote_Respondent
                                + LRD_profDif*leftRight_Respondent
                                + BornConst_profDif
                                + Age_profDif*age_respondent
                                + CutsSpending_profDif*cutsTooFar_Respondent
                                + Environment_profDif*enviroProtection_Respondent
                                + Redistribution_profDif*redist_Respondent
                                + Immigration_profDif*immigEcon_Respondent
                                + ExperienceCouncil_profDif
                                + Party_profDif ,data =., w =pull(., W8)))
                   ,
                   results = map(fit, broom::tidy)) %>%
  unnest(results) %>%
  select(-fit)

VoteLabel_heter_InteractABLab <- VoteLabel_heter_InteractABLab %>%
  mutate(
    term = fct_recode(as.factor(term),
                      "Sex Candidate"="Sex_profDif","Age Candidate"="Age_profDif" ,"Born in Constituency Candidate"="BornConst_profDif","Brexit Candidate"="Brexit_profDif" ,
                      "Experience in Council Candidate"= "ExperienceCouncil_profDif","Left-Right Candidate"="LRD_profDif","Spending Cuts Candidate" = "CutsSpending_profDif","Environment Candidate"="Environment_profDif",
                      "Immigration Candidate"="Immigration_profDif","Redistribution Candidate"="Redistribution_profDif", "Age Interaction"="Age_profDif:age_respondent", "Brexit Interaction"= "Brexit_profDif:euRefVote_Respondent", "Spending Cuts Interaction"="CutsSpending_profDif:cutsTooFar_Respondent", "Immigration Interaction"="Immigration_profDif:immigEcon_Respondent" , "Environment Interaction"="Environment_profDif:enviroProtection_Respondent", "Left-Right Interaction"="LRD_profDif:leftRight_Respondent", "Redistribution Interaction"="Redistribution_profDif:redist_Respondent", "Sex Interaction"="Sex_profDif:gender_Respondent",
                      "Age Respondent"="age_respondent", "Brexit Respondent"= "euRefVote_Respondent", "Spending Cuts Respondent"="cutsTooFar_Respondent", "Immigration Respondent"="immigEcon_Respondent" , "Environment Respondent"="enviroProtection_Respondent", "Left-Right Respondent"="leftRight_Respondent", "Redistribution Respondent"="redist_Respondent", "Sex Respondent"="gender_Respondent" 
    )
  )


VoteLabel_heter_InteractABLab <- VoteLabel_heter_InteractABLab%>%
  filter(!term == "(Intercept)" ) %>%
  mutate(
    term = fct_recode(as.factor(term),"Conservative Candidate" ="Party_profDif"),
    term = fct_relevel(term, "Left-Right Respondent","Brexit Respondent","Spending Cuts Respondent","Redistribution Respondent","Immigration Respondent","Environment Respondent", "Sex Respondent","Age Respondent",
                       
"Left-Right Interaction","Brexit Interaction","Spending Cuts Interaction","Redistribution Interaction","Immigration Interaction","Environment Interaction", "Sex Interaction","Age Interaction",

"Conservative Candidate","Left-Right Candidate","Brexit Candidate","Spending Cuts Candidate","Redistribution Candidate","Immigration Candidate","Environment Candidate", "Sex Candidate","Age Candidate","Born in Constituency Candidate","Experience in Council Candidate")
  )%>%
  mutate(
    term = str_replace(term, " Candidate", "_Candidate"),
    term = str_replace(term, " Interaction", "_Interaction"),
    term = str_replace(term, " Respondent", "_Respondent")
  )%>%
  separate(term, into = c("term", "type"), sep="_")

P.FlexibleABLab<-VoteLabel_heter_InteractABLab%>%
  ggplot(aes(x = estimate, y = term, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5) +
    geom_vline(xintercept=0, linetype="dashed", 
             size=0.5, color="blue", alpha=0.5)+
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  coord_cartesian(xlim =c(-1.5,1.5))+
  facet_grid(type~., scales = "free_y")+
  theme_classic()+
  theme(legend.position="bottom", strip.text.y =element_text(angle = 0),
        panel.grid.major.y = element_line(colour = "grey95"),
        panel.background = element_rect(colour = "black"))+
  ggtitle("Labour Voters")

```


```{r Pure-Inference0, fig.width=9,fig.height=8,out.width="\\linewidth", echo=FALSE, fig.cap="Estimates of regression coefficients for respondents' choice predicted by candidates' difference on each attribute or position. Party affiliation of candidates is omitted from model. To facilitate comparisons, the difference in position on redistribution, immigration, environment, and spending cuts, as well as difference son the left-right positions have been scaled so that the mean difference is 0 and the standard deviation is 1",fig.show='hold',fig.align='center', fig.pos="H"}
P.Closenes_HeteroByPartyAB0

```

To begin our analysis of which combinations of respondent and candidate attributes predict a respondent choosing particular candidates rather than others, we start by examining the relationship between candidate positions and vote choice.  In the first version of this analysis we do not directly use respondent's own positions in the analysis, but we split the sample on 2019 vote choice.  We fit models predicting candidate choice as a function of candidate positions, in the party labels condition and the no party labels condition, and plot the coefficients in Figure \@ref(fig:Pure-Inference0).  There is remarkably little change in the association between vote choice and candidate characteristics between the party label and no party label conditions.  The 2019 Conservative voters become more likely to support candidates opposed to redistribution and in favour of spending cuts (traditional Conservative positions) in the party labels condition than in the no party labels condition, suggesting that the party label is compensating for some of the unpopularity of these positions, however the general picture is one of stability in the relationships between vote choice and candidate characteristics across the two experimental conditions.


```{r Pure-Inference, fig.width=9,fig.height=8,out.width="\\linewidth", echo=FALSE, fig.cap="Estimates of regression coefficients for respondents' choice predicted by candidates' difference on each attribute or position. To facilitate comparisons, the difference in position on redistribution, immigration, environment, and spending cuts, as well as difference son the left-right positions have been scaled so that the mean difference is 0 and the standard deviation is 1",fig.show='hold',fig.align='center', fig.pos="H"}
P.Closenes_HeteroByPartyAB

```



Next, we add the party affiliation of the candidate as an explanatory variable.  We include this variable also in the no-labels condition so as to make both models comparable.  The results of such analysis are shown in Figure \@ref(fig:Pure-Inference).  Whereas several of the candidate position variables are significant in Figure \@ref(fig:Pure-Inference0), once we control for party affiliation of the candidates this is no longer the case.  Notably, candidates' party affiliation seems to capture most of the predictive effect of candidate positions, *even in the condition where we do not show candidates' party party to respondents*.  Put differently, within-party variation in candidate positions do not significantly predict variation in candidate choices, even in the condition where respondents are not told which candidate is from which party.



Does this mean that candidate positions do not matter?  Not necessarily, as the above analysis is on average across 2019 vote groups, and does not include respondents' own positions.  We now present an alternative analysis of the data in Figure \@ref(fig:Closeness1), where we examine how the proximity of candidates' positions and characteristics to those of respondents predict the choices of respondents with versus without party labels[^2017a].  We see that, without party labels, closeness on all issue positions is significant for respondents' choice (the four broad policies, Brexit, and the left-right positions), while the more descriptive characteristics of candidates are not (to be born in constituency, council experience, age, and sex). Including party labels in this model renders closer positions on immigration, environment, and Brexit non-significant. However, the relative proximity of respondent and candidate positions on the left-right spectrum, redistribution, and spending cuts remain significant. 
In Figure \@ref(fig:Closeness2), we fit these models separately for past Labour and Conservative voters and in the two party labels conditions of the experiment.  As in Figure \@ref(fig:Closeness1), we see more significant coefficients of proximity of candidates' positions and characteristics in the no party labels condition than the party labels condition.

[^2017a]: The same analysis is carried out in Figure A1 in the online appendix with voters in the 2017 general elections. The patterns observed remain largely the same.



```{r Closeness1, fig.width=9,fig.height=8,out.width="\\linewidth", echo=FALSE, fig.cap="Closeness of candidates' positions to respondents' positions with and without party labels as predictors of candidate choice. Redistribution, Immigration, Environment, Spending cuts, Left-Right positions have been standardized to have mean 0 and standard deviation of 1. Note: only Conservative and Labour voters in the 2019 general election included.",fig.show='hold',fig.align='center', fig.pos="H"}
grid.arrange(P.ClosenessAB)

```


```{r Closeness2, fig.width=9,fig.height=8,out.width="\\linewidth", echo=FALSE, fig.cap="Closeness of candidates' positions to respondents' positions with and without party labels as predictors of candidate choice.\nFor 2019 Conservative voters (top) and for 2019 Labour voters (bottom). Redistribution, Immigration, Environment, Spending cuts, Left-Right positions have been standardized to have mean 0 and standard deviation of 1. Note: only Conservative and Labour voters in the 2019 general election included.",fig.show='hold',fig.align='center', fig.pos="H"}
grid.arrange(P.ClosenessAB_SepPast)

```

Once again, however, *even in the no party label condition*, in both Figure \@ref(fig:Closeness1) and Figure \@ref(fig:Closeness2), the match between respondents' past vote and a candidate's party is the strongest predictor of choice in our experiment.  The coefficients of party vote are smaller (in absolute terms) than those in Figure  \@ref(fig:Pure-Inference) because proximity of positions does have some predictive power, but the coefficients of `r round(VoteCorrectByLabel2019AB_SepPast[24,"estimate"],3)` for past Conservative voters and `r round(VoteCorrectByLabel2019AB_SepPast[48,"estimate"],3)` for past Labour voters are still by far the largest coefficients in the model.




```{r,include=FALSE}
DistanceSelected<-Data_Exp1 %>%
 dplyr::summarise(
    DistanceCutsSelected = scale(case_when(
      chosen_Candidate_Party=="Labour"~abs(CutsSpending_Lab_Profile - cutsTooFar_Respondent),
      chosen_Candidate_Party=="Conservative"~abs(CutsSpending_Con_Profile - cutsTooFar_Respondent))
    ),
    DistanceEnviroinmentSelected = scale(case_when(
      chosen_Candidate_Party=="Labour"~abs(Environment_Lab_Profile - enviroProtection_Respondent),
      chosen_Candidate_Party=="Conservative"~abs(Environment_Con_Profile - enviroProtection_Respondent))
    ),
    DistanceRedistributionSelected = scale(case_when(
      chosen_Candidate_Party=="Labour"~abs(Redistribution_Lab_Profile - redist_Respondent),
      chosen_Candidate_Party=="Conservative"~abs(Redistribution_Con_Profile - redist_Respondent))
    ),
    DistanceImmigrationSelected = scale(case_when(
      chosen_Candidate_Party=="Labour"~abs(ImmigrationEcon_Lab_Profile - immigEcon_Respondent),
      chosen_Candidate_Party=="Conservative"~abs(ImmigrationEcon_Con_Profile - immigEcon_Respondent))
    ),
    DistanceBrexitSelected = case_when(
      chosen_Candidate_Party=="Labour"~abs(Brexit_Lab_Profile-euRefVote_Respondent),
      chosen_Candidate_Party=="Conservative"~abs(Brexit_Con_Profile-euRefVote_Respondent)
    ),
    DistanceLRSelected = scale(case_when(
      chosen_Candidate_Party=="Labour"~abs(LR_Lab_Profile - leftRight_Respondent),
      chosen_Candidate_Party=="Conservative"~abs(LR_Con_Profile - leftRight_Respondent))
    ),
    qsplit,
    past_vote_2019_Respondent
)%>%
  mutate(qsplit = dplyr::recode(as.factor(qsplit), "1" = "Party Label", "2" = "No Party Label")
  )

DistanceSelectedAllm<-DistanceSelected%>%
  group_by(qsplit)%>%
  summarise(
    across(starts_with("Distance"), ~mean(.x, na.rm=T)),
  )%>%
  gather("Variable","Mean", -qsplit)


DistanceSelectedAlls<-DistanceSelected%>%
  group_by(qsplit)%>%
  summarise(
    across(starts_with("Distance"), ~sd(.x, na.rm=T)/sqrt(sum(!is.na(.x))))
  )%>%
  gather("Variable","Sd", -qsplit)


DistanceSelectedAll<-left_join(DistanceSelectedAllm,DistanceSelectedAlls, c("Variable","qsplit"))

DistanceSelected_LabCon_<-DistanceSelected%>%
  filter( past_vote_2019_Respondent %in% c("Conservative","Labour"))

DistanceSelected_LabConm<-DistanceSelected_LabCon_%>%
  group_by(qsplit)%>%
  summarise(
    across(starts_with("Distance"), ~mean(.x, na.rm=T)),
  )%>%
  gather("Variable","Mean", -qsplit)


DistanceSelected_LabCons<-DistanceSelected_LabCon_%>%
  group_by(qsplit)%>%
  summarise(
    across(starts_with("Distance"), ~sd(.x, na.rm=T)/sqrt(sum(!is.na(.x))))
  )%>%
  gather("Variable","Sd", -qsplit)


DistanceSelected_LabCon<-left_join(DistanceSelected_LabConm,DistanceSelected_LabCons, c("Variable","qsplit"))

DistanceSelected_LabCon<-DistanceSelected_LabCon%>%
  mutate(
    Variable=dplyr::recode(as.factor(Variable), "DistanceBrexitSelected" = "Distance Brexit", "DistanceCutsSelected" = "Distance Cuts", "DistanceEnviroinmentSelected"="Distance Enviroinment","DistanceImmigrationSelected"="Distance Immigration", "DistanceLRSelected" = "Distance Left-Right", "DistanceRedistributionSelected"="Distance Redistribution"
    )
  )

p.DistancePolicy<-DistanceSelected_LabCon%>%
  filter(!Variable=="Distance Brexit")%>%
  ggplot(aes(x = Mean, y = Variable, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = Mean-2*Sd, xmax = Mean+2*Sd), width = 0.4) +
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
#  ggtitle("Average Distance to Selected Candidates (scaled to mean 0 and Standard Dev #1)\nLabour and Conservative 2019 Voters")+
  coord_cartesian(xlim = c(-1,1))+
  theme_clean()  


p.DistanceBrexit<-DistanceSelected_LabCon%>%
  filter(Variable=="Distance Brexit")%>%
  ggplot(aes(x = Mean, y = Variable, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = Mean-2*Sd, xmax = Mean+2*Sd), width = 0.2) +
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
#  ggtitle("Average Distance to Selected Candidates Brexit Preference\nLabour and #Conservative 2019 Voters")+
  coord_cartesian(xlim = c(-1,1))+
  theme_clean()  

```

```{r Interact-Pastvote,include=FALSE}

VoteCorrectByLabel2019_InteractPast <- Data_Exp1 %>%
  filter(past_vote_2019_Respondent %in% c("Conservative","Labour")) %>%
  mutate(qsplit = fct_recode(as.factor(qsplit), "Party Label"="1", "No Party Label"="2"),
         past_vote_2019 = as.numeric(fct_relevel(past_vote_2019_Respondent,"Labour","Conservative"))) %>%
  group_by(qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(chosen_CandidateN ~
                                  Sex_Closeness*Past_vote_2019_Lab_or_Con
                                + Brexit_Closeness*Past_vote_2019_Lab_or_Con
                                + scale(LRD_Closeness)*Past_vote_2019_Lab_or_Con
                                + BornConst_Closeness*Past_vote_2019_Lab_or_Con
                                + Age_Closeness*Past_vote_2019_Lab_or_Con
                                + scale(CutsSpending_Closeness)*Past_vote_2019_Lab_or_Con
                                + scale(Environment_Closeness)*Past_vote_2019_Lab_or_Con
                                + scale(Redistribution_Closeness)*Past_vote_2019_Lab_or_Con
                                + scale(Immigration_Closeness)*Past_vote_2019_Lab_or_Con
                                + ExperienceCouncil_Closeness*Past_vote_2019_Lab_or_Con 
                                + Past_vote_2019_Lab_or_Con, data =., w =pull(., W8))),
            results = map(fit, broom::tidy)) %>%
  unnest(results)%>%
  select(-fit)

VoteCorrectByLabel2019_InteractPast <- VoteCorrectByLabel2019_InteractPast %>%
  mutate(
    term = fct_recode(as.factor(term),
                      "Sex"="Sex_Closeness","Age"="Age_Closeness" ,"Born in Constituency"="BornConst_Closeness","Brexit"="Brexit_Closeness" ,
                       "Experience in Council"= "ExperienceCouncil_Closeness","Left-Right"="scale(LRD_Closeness)","Spending Cuts" = "scale(CutsSpending_Closeness)","Environment"="scale(Environment_Closeness)",
                       "Immigration"="scale(Immigration_Closeness)","Redistribution"="scale(Redistribution_Closeness)"
                      )
  )

P.Closeness_Pastvote2019_InteractPast <- VoteCorrectByLabel2019_InteractPast %>%
  filter(!term == "(Intercept)" ) %>%
  mutate(
    term = fct_recode(as.factor(term),"Past Party Vote 2019" ="Past_vote_2019_Lab_or_Con"),
    term = fct_relevel(term, "Past Party Vote 2019",
                       "Sex","Age","Brexit","Born in Constituency",
                       "Experience in Council","Left-Right","Spending Cuts","Environment",
                       "Immigration","Redistribution")
  )%>%
  ggplot( aes(x = estimate, y = term, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5)+
  geom_vline(xintercept=0, linetype="dashed", 
             size=0.5, color="blue", alpha=0.5)+
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  coord_cartesian(xlim = c(-0.2,1.3))+
  ggtitle("Closeness of candidates’ positions to respondents’ positions\nas predictors of candidate choice\nControlling for matching party affiliation")+
  theme_clean()


# With more flexibility

VoteLabel_heter_InteractPast <-VoteLabel_heter %>%
  mutate(qsplit = fct_recode(as.factor(qsplit), "Party Label"="1" , "No Party Label"="2")
         )%>%
  group_by(qsplit)%>%
  nest() %>%
  dplyr::summarise(fit = map(data, ~lm(chosen_CandidateN ~
                                  Sex_profDif*gender_Respondent*Past_vote_2019_Lab_or_Con
                                + Brexit_profDif*euRefVote_Respondent*Past_vote_2019_Lab_or_Con
                                + LRD_profDif*leftRight_Respondent*Past_vote_2019_Lab_or_Con
                                + BornConst_profDif*Past_vote_2019_Lab_or_Con
                                + Age_profDif*age_respondent*Past_vote_2019_Lab_or_Con
                                + CutsSpending_profDif*cutsTooFar_Respondent*Past_vote_2019_Lab_or_Con
                                + Environment_profDif*enviroProtection_Respondent*Past_vote_2019_Lab_or_Con
                                + Redistribution_profDif*redist_Respondent*Past_vote_2019_Lab_or_Con
                                + Immigration_profDif*immigEcon_Respondent*Past_vote_2019_Lab_or_Con
                                + ExperienceCouncil_profDif*Past_vote_2019_Lab_or_Con
                                + Past_vote_2019_Lab_or_Con ,data =., w =pull(., W8)))
                   ,
                   results = map(fit, broom::tidy)) %>%
  unnest(results) %>%
  select(-fit)

VoteLabel_heter_InteractPast <- VoteLabel_heter_InteractPast %>%
  mutate(
    term = fct_recode(as.factor(term),
                      "Sex Candidate"="Sex_profDif","Age Candidate"="Age_profDif" ,"Born in Constituency Candidate"="BornConst_profDif","Brexit Candidate"="Brexit_profDif" ,
                      "Experience in Council Candidate"= "ExperienceCouncil_profDif","Left-Right Candidate"="LRD_profDif","Spending Cuts Candidate" = "CutsSpending_profDif","Environment Candidate"="Environment_profDif",
                      "Immigration Candidate"="Immigration_profDif","Redistribution Candidate"="Redistribution_profDif", "Age Interaction"="Age_profDif:age_respondent", "Brexit Interaction"= "Brexit_profDif:euRefVote_Respondent", "Spending Cuts Interaction"="CutsSpending_profDif:cutsTooFar_Respondent", "Immigration Interaction"="Immigration_profDif:immigEcon_Respondent" , "Environment Interaction"="Environment_profDif:enviroProtection_Respondent", "Left-Right Interaction"="LRD_profDif:leftRight_Respondent", "Redistribution Interaction"="Redistribution_profDif:redist_Respondent", "Sex Interaction"="Sex_profDif:gender_Respondent",
                      "Age Respondent"="age_respondent", "Brexit Respondent"= "euRefVote_Respondent", "Spending Cuts Respondent"="cutsTooFar_Respondent", "Immigration Respondent"="immigEcon_Respondent" , "Environment Respondent"="enviroProtection_Respondent", "Left-Right Respondent"="leftRight_Respondent", "Redistribution Respondent"="redist_Respondent", "Sex Respondent"="gender_Respondent" 
    )
  )


P.Heterobyparty_InteractPast <- VoteLabel_heter_InteractPast%>%
  filter(!term == "(Intercept)" ) %>%
  mutate(
    term = fct_recode(as.factor(term),"Past Party Vote 2019 Respondent" ="Past_vote_2019_Lab_or_Con"),
    term = fct_relevel(term, "Past Party Vote 2019 Respondent",
                       "Sex Respondent","Sex Candidate","Sex Interaction","Age Respondent","Age Candidate","Age Interaction","Brexit Respondent","Brexit Candidate","Brexit Interaction","Born in Constituency Candidate",
                       "Experience in Council Candidate","Left-Right Respondent","Left-Right Candidate","Left-Right Interaction","Spending Cuts Respondent","Spending Cuts Candidate","Spending Cuts Interaction","Environment Respondent","Environment Candidate","Environment Interaction", "Immigration Respondent","Immigration Candidate", "Immigration Interaction", "Redistribution Respondent","Redistribution Candidate", "Redistribution Interaction")
  )%>%
  ggplot(aes(x = estimate, y = term, col = qsplit))+
  geom_point(position = position_dodge(width =0.3))+
  geom_errorbar(position = position_dodge(width =0.3),
                aes(xmin = estimate-2*std.error, xmax = estimate+2*std.error), width = 0.5) +
    geom_vline(xintercept=0, linetype="dashed", 
             size=0.5, color="blue", alpha=0.5)+
  scale_color_manual(values= c("chartreuse3", "darkorchid3"), name = "")+
  labs(x="",y="")+
  coord_cartesian(xlim =c(-0.5,0.5))+
  theme_clean()

```

Our initial analysis of the party label versus no party labels conditions revealed modest average treatment effects, concentrated among 2019 Conservative (and Brexit Party) voters, on party choice in our experiment overall.  Our subsequent analyses of the relationship between candidate choice and candidate positions (with and without respondent positions) reveal why party label revelation has such a modest impact: respondents are already far more responsive to candidate party than to any of our individual candidate positions or characteristics, even when we do not tell them candidate party explicitly.  When given candidate positions and characteristics that are realistic representations of Labour and Conservative candidates, respondents are mostly responsive to candidate party and only weakly responsive to within-party variation in positions.  

## Why is party affiliation predicting choices in the no-labels condition?

We have found that the relationship between respondent past vote and candidate party affiliation is a significant predictor of the chosen candidate, this is true for both model with only candidates' characteristics and in models based on similarity between respondent and candidates, and it is true even in the experimental condition where respondents are not explicitly told the candidate's party affiliation.  One possible explanation for this is that a substantial fraction of respondents are making inferences about which candidate is from which party on the basis of candidate positions, but then voting on the basis of that inference rather than the connection between their personal positions and those of the candidates presented.  Another possible explanation is that respondents are voting based on some function of their personal positions and those of the candidates, but we have somehow modelled the relationship incorrectly.  

In order to minimise the risk that the latter is occurring, we test a few alternative specifications of our models, in an effort to see if the magnitude of the party affiliation coefficient in the no labels condition can be substantially reduced or eliminated by respecifying the model.  Appendix Figure A5 shows the results of an analysis that, rather than modelling the choice in terms of proximity, incorporates the effects of candidates' position, respondents' positions, and the interaction of said positions. Again, this shows similarly strong effects of candidate party affiliation, even in the no labels condition.  Appendix Figure A2 presents a model with all the first order interactions.  We find little evidence of any first-degree interaction with a significant effect on respondents' choice. While the fact that the interaction coefficients are non-significant should be interpreted with caution due to reduced statistical power, the fact that past vote remains a strong predictor of candidate choice suggests that interaction between attributes is not the main factor driving candidate choice.  We similarly do not find evidence supporting a quadratic relationship in the model, as can be observed in Figure A3 in the appendix. Again, all quadratic coefficients are small (only redistribution is marginally significant), and matching past vote is still the strongest predictor of choice.  

Despite the fact that we cannot explain away the significant coefficient on the party label when it is not visible to the respondent through these model respecifications, it necessarily arises from some form of residual model misspecification, however this misspecification is related to omitted variables that the respondents know and we, as the analysts, do not.  In particular, we do not know the individual-level models by which respondents might be relating observed positions of candidates to inferred party affiliations.  We might think that these would be well-approximated by homogenous linear functions of the candidates positions and characteristics, but our results suggest that they are not.

We do think that the fact that candidates' party affiliation is a strong predictor of choice in this model, in the absence of party labels, across all these specifications, argues in favour of the interpretation that respondents are predominantly voting based on the perceived party of the candidates.  Where the party of the candidates is presented explicitly, this is easily done.  Where the party of the candidates is not presented, the no labels condition, it seems that most respondents are nonetheless able to infer which candidate is from which party and vote accordingly.  We emphasize that this does not mean respondents do not care about policy.  There are many policy dimensions that they might care about besides those in the experiment.  It does mean that the information in the candidate positions and the party labels are largely substitutes for one another, whether because respondents care about other policy issues or aspects of party performance beyond the ones we present, or because they have affective ties to the parties.  

The findings still suggest that respondents’ preferences and positions play a role in choosing a candidate. Respondents' choice does not exclusively appear to be the result of "guessing" which candidate belongs to which party, there is some responsiveness to proximity on some issues even in the party labels condition.  We see some evidence of tension between some of the Conservative candidates' positions on redistribution and spending cuts and public opinion at the time of the survey, such that without the presentation party labels past Conservative voters are more likely to "mistakenly" choose Labour candidates, in the sense that they make a different choice when the labels are present.  This might be because the presentation of the party label enables them to better capture their other reasons for generally voting Conservative.


## Conclusion

Our experiment contributes to a long-standing debate about the relevance of candidates' party labels, positions and characteristics in the presence of party competition and established party systems.  It also illustrates the use of a novel measurement strategy building on previous work with conjoint experiments. The novel contribution of this study is that we anchor the treatment distribution (the candidates characteristics) of our experiment on a real distribution, the estimated characteristics of the 2017 general elections candidates, for both Labour and Conservative. By doing this, we aim to address the question of how much candidates' positions matter in the presence of party competition, as well as the extent to which the availability of the party cue suppresses voters' response to candidate positions, given the actual distribution of policy positions of candidates in each party.  This experimental design sacrifices design-based causal inference for the impact of each individual attribute or policy position.  However, we maintain design-based causal inference for complete profiles and, model-based causal inference for individual attributes and policy positions. Additionally, it is important to notice that, as in any survey experiment, the survey format provides respondents with more issue information than they might ordinarily have about candidates.  This may tend to exaggerate the role of issues on vote choice.

We show that, in the absence of party labels, respondents' preferences are associated with the candidates that they select.  The introduction of party labels only slightly modifies these relationships.  2019 Labour voters are found to prefer Labour candidates regardless of whether party labels are presented in the experiment.  2019 Conservative voters are less likely to select Conservative candidates in the absence of party labels, but even for them the relationship between the positions of their candidate choices and their policy positions only changes with respect to a couple of issues.  We find partisan sorting of both respondents and candidates, especially on the left-right spectrum, which means that policy voting and partisan voting tend not to be in tension with one another.  However, for most issues we do find substantial numbers of voters differ from the positions of the candidates of the party they voted for in the last election, making it possible to observe whether issue positions of candidates relative to respondents predict candidate selection in the experiment, holding party constant.  We find that they do, although not very strongly relative to the party label.  

Strikingly, we find that candidate party is the strongest predictor of vote choice even when the party label is not presented to the respondent.  We suggest that this is because of a mechanism whereby respondents can infer candidate party from positions, and then largely vote on party label.  When respondents are presented with candidates whose party affiliation is omitted, respondents use other attributes as a way of inferring the candidates' party affiliation [@schaffner2002partisan; @titelman2021can].[^USUK]  This inferential mechanism makes sense whether you are a policy-oriented voter (who cares about policies in addition to those presented, which are effectively proxied by party) or a party-oriented voter (who cares about party as such).  This might appear to be an argument against the the policy voting hypothesis, however it is only an argument against the most extreme form of that hypothesis, because of the possibility that respondents care as much or more about issues that we did not present in the experiment in forming their party preference.

[^USUK]: As noted earlier, much of the literature in this area comes from the US, and we might expect some differences in the UK versus the US.  Relatively strong party discipline in the UK Parliament versus the US Congress means that within-party variation might reasonably matter less to UK voters than to US voters (although there are still a number of reasons to think it still ought to matter).  Consequently, inferring party from positions and voting on inferred party perhaps makes more sense for a UK voter than a US voter, responding to an superficially non-partisan candidate choice in the context of their political system.  

At the same time, our findings do not support the strongest forms of the "partisan intoxication" hypothesis either.  If respondents were blindly choosing candidates for their party affiliation, we would expect them to choose these candidates regardless of their own and the candidate's positions.  We also might not expect them to be as good at mapping issue positions of unlabelled candidates onto parties as they appear to be.  The respondents’ preferences and positions predict the chosen candidates in the labels-free condition of our experiment, and while these relationships are weakened with labels, they do not go away entirely.  Nonetheless, the dominant mechanism appears to be one that runs through party: respondents use the available information about policy to infer the party of the candidates, rather than because they are strongly responsive to the match with their own positions on the presented issues.  Fundamentally, these findings are in line with the argument made by @orr2023affective, that information on partisan affiliation of fellow citizens influences beliefs about policy positions, and information about policy positions influences belief on party affiliation.  The fact that voters can make these connections--inferring party affiliation from observed positions as well as unobserved positions from party affiliation--makes separating a purely affective party-oriented versus a purely instrumental policy-oriented mechanism for candidate choice extremely difficult. Our analysis does suggest, in line with @rogers2020sobering, little evidence for the extreme versions of either interpretation.
